Hi,
I am trying to drag an object to a certain point in the World with the left mouse hold. Before dragging it, it moves to the right. I already made the code where I am able to drag the object trough the world, but I want it to drag to a certain point, and when it is moved in that certain area, the object stops. Does anyone know how to do this? I can't find anything like this on the forum.
This is the code so far (moving and dragging):
Any help is appreciated
public class Bee extends Actor { public void act() { move(1); if ( Greenfoot.mouseDragged(this) ) { MouseInfo mouse = Greenfoot.getMouseInfo(); this.setLocation(mouse.getX(), mouse.getY()); } } }