How to set a target as image in given code.
public void addListenerForImage(final Image roomImage)
{
final DragAndDrop dragAndDrop = new DragAndDrop();
dragAndDrop.addSource(new DragAndDrop.Source(roomImage) {
public DragAndDrop.Payload dragStart (InputEvent event, float x, float y, int pointer) {
DragAndDrop.Payload payload = new DragAndDrop.Payload();
payload.setDragActor(roomImage);
dragAndDrop.setDragActorPosition(-x, -y + roomImage.getHeight());
return payload;
}
public void dragStop (InputEvent event, float x, float y, int pointer,Target target) {
roomImage.setBounds(50, 125, roomImage.getWidth(), roomImage.getHeight());
if(target != null) {
roomImage.setPosition(target.getActor().getX(), target.getActor().getY());
}
System.out.println(target);
stage.addActor(roomImage);
}
});
My problem is i can drag the images and i am not able to set target as image;
and target shows as null;One more if a invisible some of the images in group how can i test that it is overlapped or not;Please give some links and suggestion