Hellooooooooo everybody!
Using world.create()
, in recycled entity’s added()
, its private var targetPoint:Point
is given new values and trace confirms this. Soon later, these values are changed back to what they were the first time the entity was created. Can someone shed some light on why?
package falling_block
{
private var targetPoint:Point = new Point;
public function FallingBlock()
{
}
override public function added():void
{
targetPoint = getNewCoords();
trace(targetPoint); // Confirms new coordinates
}
// Soon later, in update:
override public function update():void
{
if (targetPoint != getCorrectCoords()) trace(targetPoint); // Values have changed????
}
}
I have since fixed the issue by:
override public function added():void
{
targetPoint = new Point;
targetPoint = getNewCoords();
}
But I’m still curious why this happened. Or, maybe this has nothing to do with world.create()? Thanks in advance for any input!