Hello,
How can I prevent that my objects keep overlaying each other.
This is my code till now:
public void followBoot()
{
if(getOneIntersectingObject(Boot.class)!= null)
{
if (Greenfoot.isKeyDown("left") && getX() > 303)
{
move(-5);
}
if (Greenfoot.isKeyDown("right") && getX() < 772)
{
move(5);
}
}
}
So what they do right now is they move when I press left or right, then they go till a certain X Y coordinate but when they get there the overlay each other. Can someone help me get this right. I want the objects to stay correct and don't overlay each other.