2014-10-22 3 views

답변

0

spritemap을 사용해보십시오.

example from flashgamedojo

는 :

import net.flashpunk.Entity; 
import net.flashpunk.graphics.Text; 

public class AnimatedEntity extends Entity{ 
    // Embed the animation image. 
    [Embed(source = 'my_animated_character.png'] private const MY_ANIM:Class; 

    protected var animatedSprite:Spritemap = new Spritemap(MY_ANIM,16,16); 
    public function AnimatedEntity() { 

     // You pass in the source image and the height and width of each frame of the animation. 
     animatedSprite = new Spritemap(MY_ANIM, 16, 16); 

     // Let's set our Entity's graphic to our new Spritemap, dawg. 
     graphic = animatedSprite; 

     // Now, you can add animations to your Spritemap! 
     // You name the animation, pass in an array consisting of the frame numbers, and the frame rate (milliseconds per frame). 
     animatedSprite.add("running", [0, 1, 2, 3], 50); 

     // It's totally cool to repeat frames, too! Out of order is nuts, but also okay. 
     animatedSprite.add("falling", [4, 4, 4, 5, 1], 50); 

     // Now, you just play your animation like so: 
     animatedSprite.play("running"); 
    } 
} 
0

당신과 같이 Flashpunk의 VarTween 클래스를 사용하여 할 수있는 :

var image:Image = (Image)(goombaEntity.graphic); 
var sizeTween:VarTween = new VarTween(); 
sizeTween.tween(image, "height", 0, 0.5); 
thisWorld.addTween(sizeTween, true); 

이 엔티티의 높이가 0.5 초에서 0으로 전체 높이에서 이동하게됩니다. 엔티티의 높이를 & 너비로 변경하려면 해당 그래픽에 액세스해야합니다.