June 2018
Beginner to intermediate
298 pages
7h 38m
English
Start by clicking on the player's AnimationPlayer and adding a new animation named climb. Its Length should be set to 0.4 seconds and the Frame values for the Sprite are 0, 1, 0, 2. Set the animation to loop.
Now, go to Player.gd and add a new state, CLIMB, to the state enum. In addition, add two new variables to the declarations at the top:
export (int) var climb_speedvar is_on_ladder = false
is_on_ladder will be used to tell if the player is on a ladder or not. Using this, you can decide whether the up arrow should have any effect. In the Inspector, set Climb Speed to 50.
In change_state(), add a condition for the new state:
CLIMB: new_anim = 'climb'
Next, in _get_input(), you need to add the climb input action and add the code ...
Read now
Unlock full access