Fangames > Programming Questions

Game maker problem

(1/1)

QuentinJanuel:
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!)

QuentinJanuel:
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
}

Navigation

[0] Message Index

Go to full version