• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Seperate options for same object?

N

NoFontNL

Guest
Hey all! A quick question: is there away (or a way to work around of it) to have 2 of the same objects in a room but have different variables? For example:

Messageblock 1: var message = "Welcome! The movements are simple. Just walk with the arrow keys!"
Messageblock 2: var message = "There is an obstacle in your way, you can jump with spacebar. Hold it to jump higher."

Do I really need to make for EVERY messageblock a seperate object? That will cost me a lot of time :v
Thanks!
 

FrostyCat

Redemption Seeker
Only a complete moron would make each message block a distinct object just to change a little value between them. Sensible people know and take advantage of the difference between objects and instances.

instance_create() returns the instance ID of the created instance. Use that to set the message for each instance of the message box.
Code:
with (instance_create(0, 0, obj_message_box)) {
  message = "Message A";
}
with (instance_create(0, 128, obj_message_box)) {
  message = "Message B";
}
 
K

kevins_office

Guest
Only a complete moron would ... Sensible people know and take advantage of ...
That sounded kind of harsh. Being inexperienced isn't the same as being a moron or non sensible.
I think its more helpful to just explain a solution, or provide a link for them to discover the answer themselves without insulting them.
I just had to say something because i see this kind of attitude a lot and i don't think it helps the community grow.
 
K

kevins_office

Guest
If you are not using code to create object instances in your room, and are just placing them in the IDE room editor, then double click on the instance in the room and it will open an instance window. In that window click the [Creation Code] button and it will open a code window. There you can write code or set variables that will be specific to just that instance, not the object itself.

After writing this i see that the author is using GM 1.4 and what i said only applies to GMS2.
 
Last edited by a moderator:
N

NoFontNL

Guest
If you are not using code to create object instances in your room, and are just placing them in the IDE room editor, then double click on the instance in the room and it will open an instance window. In that window click the [Creation Code] button and it will open a code window. There you can write code or set variables that will be specific to just that instance, not the object itself.

After writing this i see that the author is using GM 1.4 and what i said only applies to GMS2.
I've taken a look at your message, I already opened GameMaker, did all the steps you've given... And then I read it only applies to GM 2.0... BUT I want to thank you a lot! In the IDE room editor is a button called 'Instance Order'. If I right click on my messageblock and click Instance Properties, it views the precise instance name. 'inst_83C9931F'. When I then click the button Instance Order and search for inst_83C9931F and doubleclick it, it opens a code window as you told. Thanks! It really helped me out!
 
Top