Studio › Manual › 3D rooms

GameMaker pickup and door code

The kit's scr_r3d_pickup runs every pickup, key, door, exit and push wall in the room: o_r3d_scene runs them in its End Step (r3d_behave_update, after the player has moved) and draws the counts and messages in its Draw GUI (r3d_behave_draw_hud). From your own code:

  • r3d_pickup_count("coin"), r3d_pickup_total("coin"); r3d_has_key("gold"), r3d_give_key("gold"), r3d_take_key("gold").
  • r3d_door_open(door), r3d_door_close(door), r3d_door_unlock(door), r3d_door_is_open(door); r3d_room_complete(); r3d_behave_say("Hello").
  • r3d_behaviours(): the room's state (counts, totals, keys, complete, message), hud = false to draw your own, keep_between_rooms = true, and callbacks on_collect, on_door, on_complete.
  • On the thing itself, User Event 12 runs with behaviour_event set ("collect", "key", "open", "opened", "close", "shut", "locked", "unlock", "not_yet", "complete", "push", "pushed"): if (behaviour_event == "collect") { audio_play_sound(snd_coin, 1, false); }.

The numbers are Play's: a pickup bobs once every 2 seconds and pops in 0.3 s, rising 0.4 m; a door that closes again waits until the player is half a metre beyond its reach; a message stays 2.5 seconds.

Keys are shown as on the Mac: ⌘ Command, ⌥ Option, ⌃ Control, ⇧ Shift. Studio for Windows shows its own keys beside each menu item.