BananaMaster

47.2 - Battle Scene: Poison, Practice (JS lessons — arguments and return)

If you forgot something — click to go to the lesson.

📘 Task: Battle HP Bar — Poison

🏗️ What you need to prepare in HTML:

The page currently has 2 buttons that look like a icon — they're hidden. To reveal them: open the HTML file, find the blocks with the class reveal-wrapper hidden (around lines 67 and 78) and remove the word hidden from the class, so it becomes just reveal-wrapper. After that, the real buttons will appear instead of ❓: ☠️ Poison and 💚 Heal.

⚔️ Battle rules:

📐 How this should work:

Clicking Poison starts a countdown: once every second the character's HP decreases by 5, for a total of 5 times. The HP bar and text update after every tick. HP can't go below 0 — if the character dies before the poison runs out, the remaining ticks simply do nothing. Use the built-in function setTimeout. If you're not familiar with it, review the lesson before attempting this extra challenge.

Clicking Heal instantly increases the character's HP by 20. HP can't go above 100.