我基本上有这个:
Obj1创建事件:
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绘制事件:
show_debug_message(origin.x); // <-- This works just great!
show_debug_message(origin.health_current); // <-- This throws error :(
我认为变量可能是本地的,但是,我如何将其公开? GML对我来说有点新鲜,但我不是编程的新手。这让我心疼。
答案 0 :(得分:2)
使用id
,而不是self
:
health_text.origin = id;