So i’ve been sat here for a while trying to get the position of an image that is inside my UI table, i’m completely stumped.
I’m trying to highlight the selected tower so that Android users know which tower they are placing (Damn you no cursor). I’m currently doing the following code but for some reason the highlight image gets offset slightly. I don’t understand what i’m doing wrong. Without getting the localToStage coordinates the images x and y just return 0.
When I print out the images x and y using localToStage, it prints out the correct value! D:
Image image = (Image) event.getListenerActor();
Vector2 coordsOfImage = new Vector2(image.getX(), image.getY());
Vector2 localCoordsOfImage = image.localToStageCoordinates(coordsOfImage);
currentTowerSelector.setPosition(localCoordsOfImage.x, localCoordsOfImage.y);
Below I’ve attached a picture of the issue
http://s3.postimg.org/kovszy3eb/javaw_2015_06_20_20_05_26_89.png