E
EsraX
Guest
Hey there,
was wondering if anyone could help explain why the code below isn't working as i was expecting it to. I have tried work around like creating new sets of variables that dont use true/false but a numeric value but that runs into other problems.
What I expected the code to do is that whenever another object puts the variable global.basic_used as true, that each object would change itself into the next form until that variable is set to true again at which point it would change yet again. However it now instantly changes card_basic_2_obj into card_basic_1_obj instead of waiting for the variable to change again. It does however wait for the variable to change for the change of 4 to 3, and 2 to 1, so i am really lost as to what is wrong.
The code I wrote for each of the 4 objects is as follows
P.S. all of these objects also have a create event setting their depth, nothing else.
Thanks to anyone reading this and sorry if i forgot to mention something important. (first post here and havent done any coding since highschool)
was wondering if anyone could help explain why the code below isn't working as i was expecting it to. I have tried work around like creating new sets of variables that dont use true/false but a numeric value but that runs into other problems.
What I expected the code to do is that whenever another object puts the variable global.basic_used as true, that each object would change itself into the next form until that variable is set to true again at which point it would change yet again. However it now instantly changes card_basic_2_obj into card_basic_1_obj instead of waiting for the variable to change again. It does however wait for the variable to change for the change of 4 to 3, and 2 to 1, so i am really lost as to what is wrong.
The code I wrote for each of the 4 objects is as follows
GML:
if global.basic_used=true
//in the steps event in the object initially creating when the room starts
{
global.basic_used=false
instance_change(card_basic_3_obj,true);
}
GML:
if global.basic_used=true
//so this is the object the previous object changes into
{
basic_used=false
instance_change(card_basic_2_obj,true);
}
GML:
if global.basic_used=true
//this would be the object where it instantaneously changes into the next one without me wanting it to
{
global.basic_used=false
instance_change(card_basic_1_obj,true);
}
Code:
if global.basic_used=true
//last one, nothing special really. only difference is this time not an instance_change command but one to destroy itself
{
global.basic_used=false
instance_destroy();
}
P.S. all of these objects also have a create event setting their depth, nothing else.
Thanks to anyone reading this and sorry if i forgot to mention something important. (first post here and havent done any coding since highschool)