home

2014년 8월 15일 금요일

[AndEngine] 8. Animation

1. move

onCreateResources() {
    ....
    this.mBitmapTextureAtlasJump = new BitmapTextureAtlas(
            this.getTextureManger(), 200, 100, TextureOptions.BILINEAR);  //image 200x100
    this.mFaceTextureRegionJump = BitmapTextureAtlasTextureRegionFactory.createTitledFromAsset(this.mBitmapTextureAtlasJump, this, "jump.gif", 0, 0, 2, 1);  //2 images
   
    this.mBitmapTextureAtlasJump.load();
}

onCreateScene() {
    ....
    //animate(long[] pFrameDurations, int pFirstTileIndex, int pLastTileIndex, boolean pLoop)
    jump.animate(new long[] {400, 400}, 0, 1, true);
    scene.attachChild(jump);

    return scene;
}
   

2. rotate
//(float pDuration, float pFromRotation, float pToRotation)
this.registerEntityModifier(new RotationModifier(1, 0, -360));


댓글 없음:

댓글 쓰기