So I'm making a game where a spaceship (called 'Ship') orbits portal/black hole/thing called 'Skull'. Here's the code;
public void act()
{
if(Greenfoot.isKeyDown("left"))
{
Skull skull= (Skull) getWorld().getObjects(Skull.class).get(0);
turnTowards(skull.getX(), skull.getY());
setRotation(getRotation() - 90);
move(-4);
// makes sure the player orbits the portal
}
if(Greenfoot.isKeyDown("right"))
{
Skull skull= (Skull) getWorld().getObjects(Skull.class).get(0);
turnTowards(skull.getX(), skull.getY());
setRotation(getRotation() - 90);
move(4);
}
My problem is that rather than orbiting in a circle the ship orbits in a slow outward spiral.
