Okay so I'm having problems getting a bullet to shoot towards where my mouse was when I click
Heres my code so far:
Actor "Player" in act() has the checkKeys();
in checkKeys() it has:
if(Greenfoot.mouseClicked(null)){
int x = mouse.getX();
int y = mouse.getY();
shoot();
in shoot(); it has:
public void shoot()
{
Bullet bullet = new Bullet();
getWorld().addObject(bullet,getX(),getY());
bullet.turnTowards(x,y);
}
this should spawn the bullet at the player then turn the bullet towards where the mouse was clicked.
in the Bullet class, all it has is move(3); (it constantly moves foward at a speed of 3).
This isn't working for some reason. Help please