I have an entity called Zach. I then make Zach create another entity called Lewis. How do I reference Zach within Lewis?
There will be plenty of Zachs running around, so I need to refer to one of many of the same entity type.
I have an entity called Zach. I then make Zach create another entity called Lewis. How do I reference Zach within Lewis?
There will be plenty of Zachs running around, so I need to refer to one of many of the same entity type.
You could do something like:
@Main.as:
var zach:Zach = FP.create(Zach) as Zach;
add(zach.createLewis());
@Zach.as:
public function createLewis():Lewis{
var newLewis:Lewis = FP.create(Lewis) as Lewis;
newLewis.zach = this;
return newLewis;
}
And have Lewis.as
have a public variable zach
(or a get/set). Then you can read zach
from within Lewis (checking beforehand if it’s non-null).
Also I’m alive!