Tutorial 2 Pt3
To make it so pressing the W key starts the Walk animation a new parameter similar to the wave was created, but this is a Bool parameter. A Bool parameter is used because the animation needs to be looping as the key is held down, not just playing once like Wave. This parameter is added to the transitions going to and from Idle to Walk, but the condition going to walk needs to be marked as true and going back to Idle needs to be false. To make use of this parameter a code called Walk.
This code is similar to Wave but it detects when W is being actively held down, triggering the walk Bool parameter to switch to true, activating the Walk animation. Once the key is released the else statement is used, reverting the Bool back to false so the animation ends.
Door
This task is about using Unity Events to detect a character approaching a door so the door disappears.
On the character object side a new box collided is added with the trigger option ticked, its tag is set to Player and a Rigid body is added.
A basic cube is made to be the door by scaling it into a door shape.
To create a Trigger an empty game object is made with a trigger box collider added representing the area where the character will be detected. A new script was added to this called TriggerDetection, its contents can be viewed below:
This code adds an area to outline the desired event. For this tutorials purpose an action is added connected to the door with its funtion set to GameObject.SetActive.
The result of this is shown in the gif below:
KIT207 Portfolio
Status | Released |
Author | d.darius.s |
More posts
- Game IdeasAug 09, 2022
- Tutorial 2 Pt2Jul 27, 2022
- Tutorial 2 Pt1Jul 27, 2022
- Tutorial 1Jul 20, 2022
- Self Study 1Jul 19, 2022
Leave a comment
Log in with itch.io to leave a comment.