1
我在我的遊戲中使用Actor類以獲得Actors類的幾個優點。但目前我正面臨使用Stage.hit(...)方法的問題。如何修改點擊事件中的LibGdx actor屬性
正如我們所知,「命中」返回Actor對象。
public class Enemy extends Actor
{
int health = 100;
public Enemy (int type, float x, float y)
{
setX(x);
setY(y);
}
public void act(float deltaTime)
{
Actor hitActor = GameAsset.stage.hit(getX(), getY(), false);
if(hitActor != null))
{
health -= 10;
// next, should be reducing hitActor health in stage, but how?
}
}
...
問題是,有沒有辦法在上面的評論中做?
對不起,我英文不好:d
它的工作原理,感謝您的幫助。 –