Hi danpost,
I downloaded your Scrolling SuperWorld scenario and I am building some game. I have a unit which I want to move with my mouse. I tried to save the coordinates of the mouse when it is clicked and let the unit move to the target location. The problem is that when the world is scrolled, the unit's target location does not move with it. I just started, so this is the code so far. (No un-selecting and no un-targeting, but that doesn't matter right now.)
Before I mess around and complicate your neat code when trying to implement that, I wanted to ask you if you already know an easy method to make it work.
private boolean selected;
private boolean hasATarget = false;
private int targetX = 0, targetY = 0;
public void act()
{
if (Greenfoot.mousePressed(this))
{
selected = true;
}
if (selected)
{
if (Greenfoot.mousePressed(getWorld()))
{
MouseInfo me = Greenfoot.getMouseInfo();
targetX = me.getX();
targetY = me.getY();
hasATarget = true;
}
}
if (hasATarget)
{
turnTowards(targetX, targetY);
move(2);
}
}

