I Wanna Community

Fangames => Game Design => Programming Questions => Topic started by: QuentinJanuel on February 27, 2016, 08:32:40 AM

Title: Game maker problem
Post by: QuentinJanuel on February 27, 2016, 08:32:40 AM
Hey, I have a problem when I make a new object in game maker.
If I write : "a=instance_create(x,y,object2);a.mode=2" for example.
Then in the create event of the object 2 I wrote that :
if(mode==2){//do something}
and game maker returns me an error "unknown variable 'mode' "
probably because game maker checks the variable mode before to assign when it creates the object2 but idk...
What could I do? (I DON'T WANNA USE ALARMS!)
Title: Re: Game maker problem
Post by: QuentinJanuel on February 27, 2016, 09:17:44 AM
No nevermind sorry, I fixed it myself :
mode = 2;
instance_create(x,y,object2);

create event of object2 :
mode = object1.mode
if(mode == 2){
//do something
}