• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2 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