Collectible items
Before you start making the level, you need to create some pickups for the player to collect, since those will be part of the level as well. The assets/sprites
folder contains sprite sheets for two types of collectibles: cherries and gems.
Rather than make separate scenes for each type of item, you can use a single scene and merely swap out the sprite sheet texture. Both objects will have the same behavior: animating in place and disappearing (that is, being collected) when contacted by the player. You can also add a Tween
animation for the pickup (see Chapter 1, Introduction, for an example).
Collectible scene
Start the new scene with an Area2D
and name it Collectible
. An area is a good choice for these objects because you want to detect when the player contacts them (using the body_entered
signal), but you don't need collision response from them. In the Inspector
, set the Collision
/Layer
to collectibles
(layer 4) and the Collision
/Mask
to player
(layer 2). This will ensure...