Voxel Game Maker

Docs Cookbook

Enemy that chases

Place the enemy. What is it? ▸ Enemy, Type Chaser.

#Without code

  1. Place the enemy. What is it? ▸ Enemy, Type Chaser.
  2. Its Character card: Start from a role (Melee fighter, Brute, Pack hunter…).
  3. Tune Notice range, Speed and Attack damage (Chase player).
  4. Give it Health / breakable so the player can defeat it (Health, When defeated).

#Quick code

Where it goes: on the enemy, Event: Player enters the world.

while self.exists do
  if self.distance(player) < 6 then
    self.follow(player, 3, 1.2)
    if self.distance(player) < 1.5 then hurt(5) wait(1) end
  else
    self.stop()
  end
  wait(0.1)
end