public void flySpaceship()
{
move(2);
if(isAtEdge())
{
setLocation(550,250);
}
}
The code above will move the spaceship when the code is run at a speed of 2. It will also reset the spaceship to the specified location if it reaches the edge of the game world. Hope this helps a bit!