June 2018
Beginner to intermediate
298 pages
7h 38m
English
Finally, the game can be made a bit more challenging by introducing an obstacle that the player must avoid. Touching the obstacle will end the game.
Create a new scene for the cactus and add the following nodes:
Drag the cactus texture from the FileSystem dock to the Texture property of the Sprite. Add a RectangleShape2D to the collision shape and size it so that it covers the image. Remember when you added if area.is_in_group("obstacles") to the player script? Add the Cactus body to the obstacles group using the Node tab (next to Inspector).
Now, add a Cactus instance to the Main scene and move it to a location in the upper half of the screen (away from where the player spawns). Play ...
Read now
Unlock full access