I have an array of nodes, i need to get a specific Node from this array in the InputListener event using Actor hit()..
I have multiple menu items (Buttons, Levels) but the touch event not working. This is what i tried so far:
public Actor hit(final float x, final float y, final boolean b) {
...
for (int i = this.nodesList.size() - 1; i >= 0; --i) {
final Node node = this.nodesList.get(i);
if (node instanceof SpriteNode) {
SpriteNode newNode = (SpriteNode) node;
if (newNode.anchornsform.det() != 0.0f) {
final Affine2 inv = newNode.anchoreansform.inv();
...
}
}
}
}
return myactor;
}
Please help, if you have a better solution I'm open to any suggestions.
Thank you
node != nullafter you checked it withinstanceof(if it would be null instanceof would return false). Second, you're casting yourNodeobject toSpriteNode3 times. Don't. Assign it to a pointer likeif(node instanceof SpriteNode) SpriteNode newNode = (SpriteNode) node;and use thenewNodelater. Third, I don't know what do you want to achieve. Please explain your question a bit. We don't even know if your code works now or not ;) \$\endgroup\$