2

大家,任何人都可以帮助我知道是否可以像在 COCOS2D 中一样从 AndEngine 创建 AnimateSprite Sheet。

谢谢。

4

1 回答 1

0

干得好!我相信这就是您正在寻找的。

    AnimatedSprite runner = new AnimatedSprite(0, 0, mRunner);
    // Animate with 100 milliseconds each frame, start at frame 0 and go through 
    // frame 3, set to true for looping otherwise false for no looping.
    runner.animate(new long[] { 100, 100, 100, 100 }, 0, 3, true);
    scene.attachChild(runner);

并在 onLoadResources()

    this.mRunnerTexture = new Texture(512, 128, TextureOptions.DEFAULT);
    this.mRunner = TextureRegionFactory.createTiledFromAsset(this.mRunnerTexture, this, "gfx/runner.png", 0, 0, 4, 1); // 4 columns and 1 row, a 4x1 animated sprite
    this.mEngine.getTextureManager().loadTextures(this.mRunnerTexture);
于 2012-06-14T16:30:51.127 回答