import greenfoot.*;
public class Player extends Actor
{
int Speed = 1;
private int location = 0;
public void startlocation(int ort){this.location=ort;}
public int getort(){return location;}
public void actions(){
int direction = this.getRotation();
if (this.canmove()){
if (Greenfoot.isKeyDown("w"))
{setRotation(-90); move(Speed);}
if (Greenfoot.isKeyDown("a"))
{setRotation(180); move(Speed);}
if (Greenfoot.isKeyDown("s"))
{setRotation(90); move(Speed);}
if (Greenfoot.isKeyDown("d"))
{setRotation(0); move(Speed);}
}
else{
if (Greenfoot.isKeyDown("w"))
{setRotation(-90);}
if (Greenfoot.isKeyDown("a"))
{setRotation(180);}
if (Greenfoot.isKeyDown("s"))
{setRotation(90);}
if (Greenfoot.isKeyDown("d"))
{setRotation(0);}
}
}
public void doors(){
Actor ondoor1 = getOneIntersectingObject(Door1.class);
if (ondoor1!=null){
getWorld().removeObject(ondoor1);
Greenfoot.delay(10);
UnclesHouse uncleshouse = new UnclesHouse();
Greenfoot.setWorld(uncleshouse);
Speed = 2;
}
public void act(){
actions();
doors();
}
Can anyone tell me why "Speed=2" doesn't work?
It just stays at 1, but it still switches to the new world (UnclesHosue)
Any idea?
}


