Learn › Godot 2D Intermediate

Lesson 2 of 5 · About 6 min

Hearts and pickups

How Sword and Key keeps the hero alive: hearts, the blink after a hit, and the bushes that can drop a heart. Then a hero who can take more.

Hearts

The hero starts with START_HEARTS hearts, 3, and can hold at most MAX_HEARTS, also 3. A slime's touch costs one, pushes the hero back, and makes them blink for HURT_TIME, 1.2 seconds, in which nothing can hurt them. That blink is what stops two slimes taking two hearts at once.

Lose the last heart and the round is lost.

Godot 2D Intermediate is a course for paid accounts. The rest of this lesson, and its guided session, are in the app.

Start makingDownload on the App StoreGet it on Google Play