GML RPG Style Level Editing

Harper

Member
Hi all,
so I'm fairly new to Game Maker, but I understand enough to have started a top-down RPG. I've created triggers and what not that i can place in the room editor, but I have no idea how to associate their individual instances with specific events. Is it in creation code? Should I rename the instance id? I would be so thankful if anyone were to push me in the right direction.
 

CloseRange

Member
I think, maybe, I understand the question?
So for an example if you have a button that opens a door, but multiple switches that connect to multiple doors. Something like that?
hopefully I understood correctly,
if so then what you'd do is in the room editor right click the instance of the object and click 'creation code'
this will open a code editor that will allow you to edit the code for that one specific instance, none of the other instances will have that code (even if it is the same object)

you can go into both the switch and door instance and do something like this:
Code:
myID = 0;
make the myID variable the same number for what switch goes with what door/event
then in the switch code when you interact with it:
Code:
if(interacted) {
     with(obj_door) {
          if(myID == other.myID) {
              // open me
          }
     }
}
 
Top