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 laserSpaceship 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.
ExplosionExplosion from the library.
SoundsLaser, Hit and Explosion from + Built-in sound.
NutHouse
The Health bar settings: Starts at, Full at, Width, Height and colours

Build it

  1. Click empty space and set Gravity pulls to Off (everything floats).
  2. Put the Boss near the top, the Spaceship at the bottom, the bar in a corner.
  3. Open the Events tab. + New event โ†’ โŒจ Keyboard & mouse โ†’ Upon pressing key โ†’ press Space.
  4. In the โœš Create objects cell choose Create an object. Object to create: Laser. Where: X 0, Y โˆ’24, Measured from Spaceship. Play Laser.
  5. + New event โ†’ click Laser โ†’ Collides with another object โ†’ Boss.
  6. 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.
  7. + New event โ†’ click Boss health โ†’ Bar is empty. Click + andโ€ฆ โ†’ โš™ Special โ†’ Only the first time.
  8. 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.
  9. 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.

Still stuck?

Try the Chocobreak tutorial, open a sample game and read its rules, or look at the questions people ask.