when I tried this code, I got a "variable getX might not have been initialized."
/**
* Act - do whatever the Player wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
{
if (Greenfoot.isKeyDown("w"))
{
move(1);
}
if (Greenfoot.isKeyDown("s"))
{
move(-1);
}
if (Greenfoot.isKeyDown("a"))
{
turn(-2);
move(1);
}
if (Greenfoot.isKeyDown("d"))
{
turn(2);
move(1);
}}
int getX;
int getY;
if (Greenfoot.isKeyDown("m"))
{
Bullet bullet = new Bullet();
getWorld().addObject(bullet, getX + 5, getY);
}
}
}

