I want the bullets to fire from the angle that my character is facing, I was told this is the best way but it just doesn't work. Any ideas?
import greenfoot.*;
public class PlayerOne extends Actor
{
public int speed = 3;
public void act()
{
checkKeys();
}
public void fireGun()
{
World myWorld = getWorld();
Bullet bullet = new Bullet();
bullet.setRotation(getRotation());
getWorld().addObject(new Bullet(),getX(), getY());
}
private void checkKeys()
{
if (Greenfoot.isKeyDown("space"))
{
fireGun();
}
}
}
