We're celebrating the launch of Godot 4 with Quiver's second game jam! Submit your entry to win cash and to raise money for Godot.
Create Your First Godot 4 Game
Lesson 8: Handling player death
Video Notes
Our player has to meet their end at some point. In this lesson, we’ll handle the player dying.
Corrections:
There’s a small bug in the video where you can still shoot while the Player is dying. Luckily, there is an easy fix. You can change this line:
if event.is_action_pressed("fire") and ammo > 0:
to:
if event.is_action_pressed("fire") and ammo > 0 and active == true:
Lessons
- Lesson 1: Getting started with Godot 4
- Lesson 2: Overview of the Godot interface
- Lesson 3: Setting up the level
- Lesson 4: Creating the player
- Lesson 5: Spawning the platforms
- Lesson 6: Creating a collectible
- Lesson 7: Creating an enemy
- Lesson 8: Handling player death
- Lesson 9: Creating the player projectile
- Lesson 10: Adding the final touches
- Lesson 11: Exporting your game and wrapping up
AdamDee
Nov. 21, 2022 at 12:21 p.m.Instead of making a new node for ground, can’t we just use the PlayArea node and have it signal when player body exits?
amit
Nov. 21, 2022 at 3:26 p.m.Yes, I think that would work and it would be simpler too. Just make sure you set the
CollisionShape
’s mask for thePlayArea
to collide with the Player as well. Good find!