Voxel Game Maker

Docs Tutorials

Enemies and health

Choose how the player fights, place enemies, and add hearts, boulders and chests that keep the player going.

In the editor: Welcome ▸ Tutorials ▸ 2.5 ▸ ▶ Start goes on in your My Playground project with this lesson's checklist.

Build · about 30 minutes · Basic mode

What you'll make: a small cave with enemies to fight, a boulder to smash, a chest of loot and a door that opens when the last guard falls.

What you'll learn: combat, health, and items that drop.

Before you start: do A talking character.

#1. Choose how the player fights

  1. Open Game Settings.
  2. In the Combat group, set Combat style to Light action: left click swings, Ctrl rolls out of the way.

Classic is the other common choice: left click shoots a bolt that costs mana, V swings.

#2. An enemy

  1. Place the Slime. In Properties, under What is it?, pick Enemy and set its Type to Chaser.
  2. Set its Health and Speed.
  3. Under Moves, pick a Preset for how it attacks.

Play it now: walk near it. It comes after you. Hit it until it's defeated. A Chaser drops two coins.

#3. One that keeps its distance

Place the Turret and make it an Enemy with the Type Shooter. Set its Damage and Range (tiles). Put it on a ledge where it's hard to reach.

Play it now: dodge its shots on the way up.

#4. Getting health back

  1. Place the Heart. Make it a Pickup with the Type Heart and set Restores health.
  2. Place a Checkpoint at the cave mouth and tick Refill health.

Play it now: get hurt, then touch the heart. The health bar fills up.

#5. A boulder and a chest

  1. Place the Boulder. Make it Breakable, set Health, and type Heart = 1 in Drops.
  2. Place the Chest. Make it a Chest and type Coin = 5 in Gives.

Play it now: smash the boulder, and press E on the chest.

#6. A door for the last guard

  1. Pick the toughest enemy. In Properties ▸ Rules, click + Add a rule and set When to it's destroyed.
  2. In Do, pick Set switch, with Switch guard_beaten and To On.
  3. Place the Locked gate deeper in the cave. Make it a Door with the Type Opens with a switch, and type guard_beaten in its Switch.

Play it now: defeat the guard. The door opens.

#Try it yourself

  • Turn the guard into a boss: under Moves, click Make it a boss.
  • Hide a boulder that drops a key for a locked chest.
  • Switch the Combat style to Classic and play the cave again. Which feels better for your game?

#Learn more

#Next

Take apart: Hollowfield.