动画精灵在 AndEngine 中的动画效果不止一次
我试图只对精灵进行一次动画处理,但它进行了两次动画处理,有人可以帮助我吗?这是代码
CuttingLineEffect(float x, float y, TiledTextureRegion line_region)
{
super(x, y, line_region);
this.animate(60, 1);
this.mPhysicsHandler = new PhysicsHandler(this);
this.registerUpdateHandler(this.mPhysicsHandler);
this.setPosition(x-this.getWidth()/2-50+this.getWidth()/2,y+50);
}
@Override
protected void onManagedUpdate(float pSecondsElapsed) {
if(!set)
{
MainMenu.LineList.add(this);
set = true;
}
if(!this.isAnimationRunning() && !time_to_unload)
{
time_to_unload = true;
}
super.onManagedUpdate(pSecondsElapsed);
};
I was trying to animate a sprite only once but it is animated twice can any one help me with this?? Here is the code
CuttingLineEffect(float x, float y, TiledTextureRegion line_region)
{
super(x, y, line_region);
this.animate(60, 1);
this.mPhysicsHandler = new PhysicsHandler(this);
this.registerUpdateHandler(this.mPhysicsHandler);
this.setPosition(x-this.getWidth()/2-50+this.getWidth()/2,y+50);
}
@Override
protected void onManagedUpdate(float pSecondsElapsed) {
if(!set)
{
MainMenu.LineList.add(this);
set = true;
}
if(!this.isAnimationRunning() && !time_to_unload)
{
time_to_unload = true;
}
super.onManagedUpdate(pSecondsElapsed);
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Animate() 第二个参数是您想要循环该动画的次数。因为您只想在使用时为其设置动画。
The Animate() second parameter is how many times you want to loop that animation. because you only want to animate it once you might aswell use.
100
-->每帧的持续时间false
-->第二个参数是你想要或不循环。100
--> the time duration for each framefalse
--> the second parameter is either you want to loop or not.