Voxel Game Maker

Docs Cookbook

Stomp an enemy

Place an enemy (a Slime). In Properties, What is it? ▸ Enemy.

#Without code

  1. Place an enemy (a Slime). In Properties, What is it? ▸ Enemy.
  2. Switch to Advanced. With it picked, click + Add behavior ▸ Logic ▸ Trigger.
  3. Set When to Touched.
  4. Under If, + Add condition ▸ Code is true, and type its Code: player.y > self.y + 0.5 (the player is above it: they landed on top).
  5. Under Then, change the first action to Remove object, then + Add action ▸ Launch player (Which way Straight up, Speed (tiles/s) 10) for the bounce, and + Add action ▸ Play sound (pop).
  6. Try it: press ▶ Play and jump on the slime. Walking into it from the side still hurts.

#Quick code

Where it goes: on the enemy, Event: Player touches / steps on it.

if player.y > self.y + 0.5 then
  self.remove()
  launch("up", 10)
  play("pop")
end