I have a class Card with the method setOwner. I have set up my touch input to use a hitActor to identify touches by getting the Actor's name like so :
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
Vector2 hitCoord = stage.screenToStageCoordinates(new Vector2((float) screenX, (float) screenY));
Actor hitActor = stage.hit(hitCoord.x, hitCoord.y, false);
if (hitActor != null) {
stage.getRoot().findActor(hitActor.getName()).setOwner();// here it doesnt identify the setOwner() method;
}
return false;
}
The problem is that it doesn't identify the method setOwner().
My Card actors are in a ListArray deck so I type casted them like so :
for (Card c : deck) {
c = (Card) stage.getRoot().findActor(c.getName() + c.getSuit());
}
But still it doesn't identify the methods declared in the Card class. My goal is to call the methodsetOwner on the Actor that got touched.