Health, Lives & Invulnerability Frames
📌 What you will learn
Prevent instant death on contact by adding brief invulnerability frames after taking damage.
Core approach
Without a cooldown, touching an enemy drains 30 HP in one second! Set an "invuln" timer or wait 1 second while blinking the player sprite.
- Clamp HP between 0 and max_hp.
- Blink with ghost effect (50 → 0) during invulnerability.
- Broadcast "Game Over" cleanly when HP < 1.
Pro tip & next steps
Play a distinct hurt sound so players immediately notice damage.
FAQ
What is the best first step for "Health, Lives & Invulnerability Frames"?
Clamp HP between 0 and max_hp. Play a distinct hurt sound so players immediately notice damage.
This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.