June 2018
Beginner to intermediate
298 pages
7h 38m
English
The crouching state is useful if you have enemies or projectiles that the player needs to dodge by ducking under them. The sprite sheet contains a two-frame animation for this state:

Add a new animation called crouch to the player's AnimationPlayer. Set its Length to 0.2 and add a track for the Frame property that changes the value from 3 to 4. Set the animation to loop.
In the player's script, add the new state to the enum and state change:
enum {IDLE, RUN, JUMP, HURT, DEAD, CROUCH}
CROUCH: new_anim = 'crouch'
In the get_input() method, you need to handle the various state transitions. When on the ground, the down input should ...
Read now
Unlock full access