Closed gamedevsam closed 11 years ago
I don't understand you, everything is working for me. here is my simple test:
package ;
import org.flixel.FlxG;
import org.flixel.FlxObject;
import org.flixel.FlxSprite;
/**
* ...
* @author Zaphod
*/
class TurretTest extends FlxSprite
{
public function new(X:Float, Y:Float)
{
super(X, Y);
loadGraphic("assets/game/sprites/turret_fire.png", true, true, 64, 64);
addAnimation("idle", [0], 0, false);
addAnimation("fire", [1, 2, 3, 4, 5, 6, 7, 8], 24, false);
play("idle");
}
override public function update():Void
{
super.update();
if (FlxG.mouse.x > this.getMidpoint().x)
{
facing = FlxObject.RIGHT;
}
else
{
facing = FlxObject.LEFT;
}
if (FlxG.mouse.justPressed())
{
play("fire");
}
}
}
i add these lines in my test state's create method to test this sprite:
var turret:TurretTest = new TurretTest(FlxG.width * 0.5, FlxG.height * 0.5);
add(turret);
@crazysam maybe you mistook directions
Ahhhhh!
I just noticed I was still assigning flipped = 0
in my constructor, after loading the animation. Maybe that internal variable should be named _flipped
. Messing with it is bad :-P
I have
And later on I set flipped = true & facing = FlxObject.RIGHT, it still doesn't play the animation flipped.