How can i know which child is run the code?

K

khMohamad79

Guest
Hi
i have a parent object which contains 4 objects as child
in onCreate Event of parent i want to define a variable depending on the object name like this:

switch (?????????????){
case object_1:
var number = 100;
break;
case object_2:
var number = 200;
break;
case object_3:
var number = 300;
break;
case object_4:
var number = 400;
break;
}
 

GMWolf

aka fel666
Better yet, in the create event of the child object, write number = 300; (or whatever it needs to be).

The call event_inherited so the parent code can run. (Depending on the logic, event inherited may need to go before, or after you number =??? line)
 
Last edited:
Top