public void shoot()
{
MouseInfo mouse = Greenfoot.getMouseInfo();
if(mouse != null)
{
if(shootdelay >= 20)
{
Bullet b = new Bullet();
getWorld().addObject(b, getX(), getY()); //Adds bullet at the Players X and Y.
b.turnTowards(mouse.getX(), mouse.getY()); //Turns the bullet towards the mouse.
shootdelay = 0; //Resets the shootdelay back to 0.
}
}
}