So I have this little class, meant to be a baloon text box:
package interface_elements
{
import assets.Assets;
import net.flashpunk.Entity;
import net.flashpunk.FP;
import net.flashpunk.graphics.Graphiclist;
import net.flashpunk.graphics.Image;
public class TextBaloon extends Entity
{
private var borderLeft:Image;
private var borderRight:Image;
private var borderBottom:Image;
private var borderTop:Image;
private var borderLowerLeft:Image;
private var borderLowerRight:Image;
private var borderUpperLeft:Image;
private var borderUpperRight:Image;
private var pointer:Image;
private var baloonGraphics:Graphiclist;
public function TextBaloon(x:Number, y:Number)
{
borderLeft = new Image(Assets.TEXT_BALOON_LEFT);
borderRight = new Image(Assets.TEXT_BALOON_RIGHT);
borderBottom = new Image(Assets.TEXT_BALOON_BOTTOM);
borderTop = new Image(Assets.TEXT_BALOON_TOP);
borderLowerLeft = new Image(Assets.TEXT_BALOON_LOWER_LEFT);
borderLowerRight = new Image(Assets.TEXT_BALOON_LOWER_RIGHT);
borderUpperLeft = new Image(Assets.TEXT_BALOON_UPPER_LEFT);
borderUpperRight = new Image(Assets.TEXT_BALOON_UPPER_RIGHT);
pointer = new Image(Assets.TEXT_BALOON_POINTER);
baloonGraphics = new Graphiclist();
baloonGraphics.add(borderTop);
baloonGraphics.add(borderUpperLeft);
borderTop.scaleX = 50;
borderTop.x = borderUpperLeft.scaledWidth;
baloonGraphics.x = 120;
baloonGraphics.y = 120;
super(x, y, baloonGraphics, null);
}
override public function update():void {
baloonGraphics.x += FP.elapsed * 2;
}
}
}
This is the class I was starting to do. You se there is an update that moves the graphiclist to the left, but the problem is the two images contained in the graphic list are not moving at the same time. The first image is moving in a more delayed motion, creating a gap between them.
And I noticed that if I take out the FP.elapsed and leave just a “+= 2”, that doesn’t happen.
Does anyone have any idea what is causing the problem?