Accessing a custom instance variable from another object instance
I basically have this:
Obj1 Create event:
health_total = 50;
health_current = health_total;
health_text = instance_create(x,y-10,obj_health); // Object to show health of an instance object
health_text.origin = self; // Assign an 'origin' variable so I can access it later?
obj_health Draw Event:
show_debug_message(origin.x); // <-- This works just great!
show_debug_message(origin.health_current); // <-- This throws error :(
I am guessing the variable could be local, but then how can I make it public? GML is a bit new to me, but I'm not new to programming. It makes me feel pain.
+3
source to share