hello,
I'm making a game, the goal is that you can direct a ship with your mouse. i already finished the part where you can select the object and can direct it. but somehow it is not working correctly. The object doesnt go where i want it to go. its always 1 or 2 centimeter from the point where i click. And when i click on my object its change its direction too. this is my current code:
public void move1()
{
if (state == true)
{
if (Greenfoot.mouseClicked(this))
{
state = false;
}
}
else if (state == true)
{
if(Greenfoot.getMouseInfo() != null)
{
if(Greenfoot.getMouseInfo().getButton() == 1)
{
mouseX = Greenfoot.getMouseInfo().getX();
mouseY = Greenfoot.getMouseInfo().getY();
turnTowards(mouseX, mouseY);
}
}
}
}
I hope you can help me out

