Voxel Game Maker

Docs Cookbook

Patrol then chase

Place the guard. Add Patrol path, click + Stops and click tiles in order.

#Without code

  1. Place the guard. Add Patrol path, click + Stops and click tiles in order.
  2. Add Chase player and set its Range. When the player gets away, it wanders home.
  3. Optional: a Trigger (Advanced) When it spots you, Then Speech bubble ("Hey!").

#Quick code

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

while self.exists do
  if self.distance(player) < 6 then
    self.follow(player, 3, 1.2)
  else
    self.go_home(2)
  end
  wait(0.2)
end