Voxel Game Maker

Docs Cookbook

Locked door and key

Place the key model. What is it? ▸ Pickup, Type Key (its item is Key).

#Without code

  1. Place the key model. What is it? ▸ Pickup, Type Key (its item is Key).
  2. Place the door. What is it? ▸ Door, set to need the key.
  3. In Advanced this is an Opening door with Opens when E, Needs item Key, tick Uses up the item, and a Locked message ("It's locked.").
  4. Pick Opens by (slide up, swing…) and Seconds.

#Quick code

Where it goes: on the door, Event: Player presses E.

if has("Key") >= 1 then
  take("Key")
  self.move(0, 3, 0, 1)
else
  popup("It's locked.")
end