• 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!

GameMaker Variable Definition not reading

Okay, so I have this in the creation code...
Code:
s_default = sTestBlock;

sprite_index = s_default;

and this in the variable definitions...



and in the room this is what I set it to...



Yet it doesn't seem to read the variable definition in the room. I change the variable to a different sprite via the variable definition but it still remains on the test block as set in the creation code.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Variable definitions are compiled and run on the instance BEFORE the create event, so the create event code is overriding what you have in the variable definition.
 
Variable definitions are compiled and run on the instance BEFORE the create event, so the create event code is overriding what you have in the variable definition.
Okay so what I want to do is have an object that I can set the sprite index on inside of the room but different sprites on multiple instances of the same object. Is this not achievable with variable definitions? I see people all the time setting something to say "0" in their create then using a variable definition to change the integer. Works for that, why not this? And how do i?
 
Top