libGDX:如何检查演员是否在舞台上 [英] libGDX : How check if the actor exist on stage or not

查看:96
本文介绍了libGDX:如何检查演员是否在舞台上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检查演员是否已被移除?

How can I check the actor is removed or not on stage ?

像这样:

if(actor.isRemoved) {
   // enter code here
}

推荐答案

来自

getStage

getStage

public Stage getStage()返回此actor所在的阶段 当前处于;如果不在舞台中,则为null.

public Stage getStage() Returns the stage that this actor is currently in, or null if not in a stage.

所以您可以像这样使用它:

So you can use it like:

if(actor.getStage() == null) {
    //actor not on stage
}

这篇关于libGDX:如何检查演员是否在舞台上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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