3

我基本上有这个:

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 对我来说有点新,不过,我对编程并不陌生。这让我心痛。

4

1 回答 1

2

使用id,而不是self

health_text.origin = id;
于 2015-07-23T04:20:12.240 回答