By using this site, you agree to our Privacy Policy and our Terms of Use. Close

Double changed to double now, thanks

Alright, so I added a ship to the bullet constructor and defined the x and y velocities as you said

Then I went to the Alien class, where bullets are constructed and added a method to determine the closest SpaceShip (which as there's only 1 I have just told to return the SpaceShip from game called ship

SpaceShip closestShip() {
return Game.ship;
}

which gave me the same 'non-static variable ship cannot be referenced from a static context' error

I also tried

SpaceShip closestShip = Game.ship;

But received the same error messege

and altered the bullet generating line to read

bw.bullets.add(new Bullet(x, y,closestShip));
But it can't find closestShip because the above didn't work