I am trying to work out the rotation of my plane, but every time I inspect the planes rotation array I only get 0 for both rotations, and when I work it out on a calculator the rotations I should be getting is 144 and 0. Heres the code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Player here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Player extends SpriteSheet
{
public int[] rotation = {0, 0};
public Player() {
setImage(getSprite(new GreenfootImage("Plane.png"), 400, 0, 600, 200, 200, 200));
}
public void act() {
Worldy world = (Worldy)getWorld();
rotation[0] = (int)((double)(world.view[0]/3000)*360);
rotation[1] = (int)((double)(world.view[1]/3000)*360);
if(Greenfoot.isKeyDown("a")) {
world.lookLeft(10);
setImage(getSprite(new GreenfootImage("Plane.png"), 200, 0, 400, 200, 200, 200));
} else if(Greenfoot.isKeyDown("d")) {
world.lookRight(10);
setImage(getSprite(new GreenfootImage("Plane.png"), 600, 0, 800, 200, 200, 200));
} else {
setImage(getSprite(new GreenfootImage("Plane.png"), 400, 0, 600, 200, 200, 200));
}
if(Greenfoot.isKeyDown("w")) {
world.lookUp(10);
} else if(Greenfoot.isKeyDown("s")) {
world.lookDown(10);
}
}
}

