June 2018
Beginner to intermediate
298 pages
7h 38m
English
When the game starts, the main scene will need to inform the player that the game has begun. Add the start() function as follows, which the main scene will use to set the player's starting animation and position:
func start(pos): set_process(true) position = pos $AnimatedSprite.animation = "idle"
The die() function will be called when the player hits an obstacle or runs out of time:
func die(): $AnimatedSprite.animation = "hurt" set_process(false)
Setting set_process(false) causes the _process() function to no longer be called for this node. That way, when the player has died, they can't still be moved by key input.
Read now
Unlock full access