Part 2 – Coin scene
In this part, you'll make the coins for the player to collect. This will be a separate scene describing all of the properties and behavior of a single coin. Once saved, the main scene will load the coin scene and create multiple instances (that is, copies) of it.
Node setup
Click Scene |
New Scene
and add the following nodes. Don't forget to set the children to not be selected, like you did with the Player
scene:
Area2D
(namedCoin
)AnimatedSprite
CollisionShape2D
Make sure to save the scene once you've added the nodes.
Set up the AnimatedSprite
like you did in the Player scene. This time, you only have one animation: a shine/sparkle effect that makes the coin look less flat and boring. Add all the frames and set the Speed (FPS)
to 12
. The images are a little too large, so set the Scale
of AnimatedSprite
to (0.5
, 0.5
). In the CollisionShape2D
, use a CircleShape2D
and size it to cover the coin image. Don't forget: never use the scale handles when sizing a collision shape. The...