mardi 26 mai 2015

How to use CitrusSprite.velocity

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?

Aucun commentaire:

Enregistrer un commentaire