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:

  • 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 the PlayArea to collide with the Player as well. Good find!

Want to get into the mix? Sign in or register to comment.

Next lesson