Home > Articles

  • Print
  • + Share This
This chapter is from the book

Exercises

  1. Make it so that the spaceship’s Sprite does not move past the screen border anymore by adding a margin of 8 pixels or more to the code of Listing 5.2.

  2. Create a dynamic difficulty that depends on the score by adding the value of the score variable to asteroid_instance.move_speed in the _on_spawn_timer_timeout function of Listing 5.9.

  3. Spawn asteroids faster with time by multiplying the wait_time variable of the “spawn_timer” node in the _on_spawn_timer_timeout function of Listing 5.9 with 0.99. By multiplying itself by 0.99, the wait_time will decrease slowly without becoming a negative (like it would by just subtracting a fixed time).

  4. Assign a new game icon to the project by overwriting icon.png in the root folder of the project with the “icon.png” provided in the accompanied “Godot-Hour5” folder.

  5. Try getting a score over 300!

  • + Share This
  • 🔖 Save To Your Account