我有一个舞台的屏幕课。在构造函数中,我将UIBar和BattleScene添加到舞台上。 UIBar在UI栏上绘制所有内容,而BattleScene则在战场上绘制所有内容。 BattleScene拥有一系列CharacterSlots [6]。每个字符槽都有x和y位置,并附有actor。
在我的BattleScene绘制方法中,我调用每个CharacterSlot的draw方法,并调用附加到它们的actor的draw方法。
我对演员的界限如下:
actor.setBounds(actor.getX(),actor.getY(),actor.getWidth(),actor.getHeight());
现在,屏幕上的所有内容都得到了很好的绘制,但是actor并没有响应我在构造函数中附加到它们的侦听器,如下所示:
this.addListener(new ClickListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
System.out.println("ay");
currentlyChosen = reference;
return true;
}
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
}
});