Create a new Scene
Create a new Scene
Add an Area2D Node
Add an Area2D Node
Rename it to Spikes
Rename it to Spikes
We will detect collisions and
We will detect collisions and
Trigger events when collisions occur
Trigger events when collisions occur
Add a Sprite and use the tile_0068.png
Add a Sprite and use the tile_0068.png
as the texture.
as the texture.
Add a CollisionShape2D node and set the shape to RectangleShape2D
Add a CollisionShape2D node and set the shape to RectangleShape2D
Resize the collision shape to fit the spikes
Resize the collision shape to fit the spikes
Scripting the Spikes
Scripting the Spikes
Add a new script to the spikes node
Add a new script to the spikes node
Connect the body_entered signal.
Connect the body_entered signal.
Check if the colliding body is the Player
Check if the colliding body is the Player
Call the game_over function
Call the game_over function
The functionaly for the spikes is the same as the enemy
The functionaly for the spikes is the same as the enemy
Now you add Spikes to the level to challenge the player
Now you add Spikes to the level to challenge the player