The big question here is about closure when using FP. recycle and FP.create…
okay, so when one uses FP.recycle, what happens to the objects member variables? For instance, if my entity has member variable currentThoughts:Vector<String>
, and I call
myEntity.currentThoughts.push("I have come back from the dead!")
myEntity.recycle();
FP.world.create(myEntity);
trace(myEntity.currentThoughts[0]);
am I going to trace out “I have come back from the dead!”? Or are all the member variables reset to the states specified by the constructor? Does FP.create bypass the constructor entirely?
That said, my general impression of the use of create is this:
If you are planning to instantiate your entity with the create method, you need to essentially move your constructor details into a separate, created()
function which you then call via FP.world.create(myEntity).created();
is that about right?