A boss with a health bar
By the end you will have a boss whose bar drops with every hit. When the bar is empty, the boss explodes.
What you need
The Health bar is Advanced. Switch to Advanced mode first.
| Boss | + Add object โ Library โ Flying Saucer. Name it Boss. Set How it moves to Patrols back and forth, Speed 20. |
|---|---|
| Ship and laser | Spaceship and Laser from the library. The ship slides left and right. |
| Health bar | + Add object โ New โ Health bar. Starts at 100, Full at 100, Width 200. Name it Boss health. |
| Explosion | Explosion from the library. |
| Sounds | Laser, Hit and Explosion from + Built-in sound. |

Build it
- Click empty space and set Gravity pulls to Off (everything floats).
- Put the Boss near the top, the Spaceship at the bottom, the bar in a corner.
- Open the Events tab. + New event โ โจ Keyboard & mouse โ Upon pressing key โ press Space.
- In the โ Create objects cell choose Create an object. Object to create: Laser. Where: X 0, Y โ24, Measured from Spaceship. Play Laser.
- + New event โ click Laser โ Collides with another object โ Boss.
- In the Laser cell choose Destroy. In Boss health choose Take some away from the bar, 10. In Boss choose Flash (blink), 0.3. Play Hit.
- + New event โ click Boss health โ Bar is empty. Click + andโฆ โ โ Special โ Only the first time.
- In โ Create objects choose Create an object: Explosion at X 0, Y 0 Measured from Boss. In Boss choose Destroy. In โ Special choose Shake the screen, 8 pixels for 0.5 seconds. Play Explosion.
- Press โถ Play level. Ten hits and the boss is gone.
WhenUpon pressing Space
DoCreate Laser at (0, โ24) from SpaceshipPlay sound Laser
WhenLaser collides with Boss
DoDestroy LaserTake 10 from Boss healthBoss flashes for 0.3 secondsPlay sound Hit
WhenBoss health is emptyOnly the first time
DoCreate Explosion at BossDestroy BossShake the screenPlay sound Explosion
Make it yours
- Make the boss fight back: Every 2000 ms โ Boss Shoot at another object: Laser aimed at Spaceship, speed 30.
- Two bars: a Health bar for the player too. Spaceship collides with Boss โ Take some away from the bar.
- A second stage: Compare bar, โค at most 50 โ Set speed of Boss to 60.