I have the following function in a scene that extends citrus.core.starling.StarlingState
- it loads the PlayerRun
animation and displays it on the screen. For the most part, this code works: I see the sprite on the screen (it's running in place).
protected final override function DrawScene ():void
{
Player = new CitrusSprite ( "Player" );
Player.velocity = [60, 0]; // Doesn't seem to have an effect
Player.x = 40;
Player.y = 40;
var oClip:MovieClip = new MovieClip ( Resources.getTextures (
"PlayerRun" ), 24 );
Player.view = oClip;
add ( Player );
}
I'm not sure how I'm supposed to use the velocity
property - there's no documentation for it and no matter what numbers I use in the code above, it doesn't change the display: the animation plays but the sprite is stationary (it doesn't move horizontally as I would expect it).
Am I using the velocity
property incorrectly? Does Citrus support sprite velocity or is this something I'd have to implement myself?
As it turns out,
CitrusSprite
has a property,updateCallEnabled
that'sfalse
by default and disables calls toupdate()
. Once I set this property totrue
, the code started working as expected.