Hello, I'm trying to make a sliding puzzle game and so far I've been trying to make the collision work between the puzzle pieces and the world border but I can't figure it out.
This is what I've done until now, can someone help me edit it so It can detect collision
public void Positioning(){
if(Greenfoot.mouseDragged(this)){
MouseInfo mouse = Greenfoot.getMouseInfo();
setLocation(mouse.getX(), mouse.getY());
}
if (Greenfoot.mouseDragEnded(this)){
Actor choice = getOneIntersectingObject(Box.class);
if (choice != null && getOneIntersectingObject(Mover.class) == null){
setLocation(choice.getX(), choice.getY());
prevX = getX();
prevY = getY();
}
else
setLocation(prevX, prevY);
}
}
EDIT: This is what I'm trying to do: http://www.bestqualitytoys.com/files/images/thinkfunlarge/5853.jpg
