Home > Articles

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

Workshop

Answer the following questions to make sure you understood the content of this hour.

Quiz

  1. What does the One Shot property of a Timer node do?

  2. How can we prevent our pixel art from getting blurry?

  3. What are the steps needed to spawn another scene into a scene by script?

  4. What does queue_free do and when?

  5. How does the “score” Label in the stage scene know when it needs to update its score?

Answers

  1. It lets the Timer stop after a timeout. Without the property, the Timer would restart again.

  2. We need to turn off the filter property in the import dock or use the 2D Pixel preset.

  3. We need to preload the scene, instantiate it with instance, set its position, and then add it as a child to the parent scene using add_child.

  4. The queue_free function deletes a node from memory and therefore removes it from the game. It does this after the node has finished all its processing, including all input and signals that need to be processed.

  5. The “score” Label is updated by the stage script. The stage script connects to the score signal of an asteroid when it gets spawned into the game. As soon as the asteroid is destroyed, it emits its score signal, which causes the stage to increment its internal score variable and write it to the “score” Label.

  • + Share This
  • 🔖 Save To Your Account