如何在LibGDX中暂停演员的动作? [英] How is it possible to pause an action of an actor in LibGDX?

查看:119
本文介绍了如何在LibGDX中暂停演员的动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我向演员添加了以下操作:

I added the following action to my actor:

this.addAction(sequence(delay(0.5f), alpha(1, 2), delay(2), alpha(0, 2)));

是否有一种简单的方法可以暂停此动画,然后在单击按钮时继续播放它?

Is there an easy way to pause this animation and then continue it when a button is clicked?

推荐答案

如果您的actor仅在运行动作,建议停止调用actor的act()方法.如果需要,请扩展Actor来设置开关.

If your actor is only running action, I suggest to stop calling the act() method of the actor. Extend Actor to set a switch if needed.

public void act(){
  if(mUpdateAnimation){
     this.act(delta)
  }
}

这篇关于如何在LibGDX中暂停演员的动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆