Hi my character only shoots left when pressing the left arrow key. The other arrow keys do nothing, why is this?
Here is the bullet act
public void act()
{
if (Greenfoot.isKeyDown("a"))
{
setRotation(180);
move(10);
}
if (Greenfoot.isKeyDown("d"))
{
setRotation(0);
move(10);
}
if (Greenfoot.isKeyDown("w"))
{
setRotation(270);
move(10);
}
if (Greenfoot.isKeyDown("s"))
{
setRotation(90);
move(10);
}
if ("left".equals(Greenfoot.getKey()))
{
setRotation(180);
fire();
}
if ("right".equals(Greenfoot.getKey()))
{
setRotation(0);
fire();
}
if ("down".equals(Greenfoot.getKey()))
{
setRotation(90);
fire();
}
if ("up".equals(Greenfoot.getKey()))
{
setRotation(270);
fire();
}
}
private void fire()
{
Bullet bullet = new Bullet();
getWorld().addObject(bullet, getX(), getY());
bullet.setRotation(getRotation());
bullet.move(30);
} public void act()
{
move(10);
}
