【发布时间】:2015-11-18 08:59:04
【问题描述】:
我正在使用 stackover 上的一个类来制作演员的动画,但我在物理设备上崩溃了
类AnimatedImage.java:
public class AnimatedImage extends Image
{
protected Animation animation = null;
private float stateTime = 0;
public AnimatedImage(Animation animation) {
super(animation.getKeyFrame(0));
this.animation = animation;
}
@Override
public void act(float delta)
{
((TextureRegionDrawable)getDrawable()).setRegion(animation.getKeyFrame(stateTime+=delta, true));
super.act(delta);
}
}
create() 方法,获取帧并添加到舞台:
Array<TextureRegion> waveArrayTextureRegions = new Array<TextureRegion>();
for(int i = 1; i < 24; i++){
waveArrayTextureRegions.add(new TextureRegion(new Texture("wave/4096/wave ("+i+").png")));
}
waveAnimation = new Animation(0.15f,waveArrayTextureRegions, Animation.PlayMode.LOOP);
waveActor = new AnimatedImage(waveAnimation );
waveActor.setWidth(Gdx.graphics.getWidth() / 1.05f);
waveActor.setHeight(Gdx.graphics.getHeight() / 1.05f);
waveActor.setPosition(0,0);
stage.addActor(waveActor);
我会添加这个类是动画演员,并且,在 Android 上没问题,但是当我通过 RoboVM 在我的 iPhone 上安装它时崩溃。 喜欢 iPhone 可能是上课或有什么问题? iPhone 模拟器上的 Additirruta 仅在我将它放在我在此类中崩溃的物理设备上时才有效。 有人可以帮帮我吗?
【问题讨论】:
-
您能否提供有关崩溃的更多信息?回溯和/或日志会很有帮助。
-
就像 user2016436 说我们需要更多信息。随机猜测:纹理太大或文件系统无法按您预期的方式工作。
标签: java android ios iphone libgdx