So basically I'm making Space Invaders (because I just made Pong so I decided to make another arcade game), and I'm getting this error. I have this code in my class for the bullet the spaceship (that you control) fires.
When I try to compile, I get the error message:
How do I get around this? (Space is my World, and Spaceship is... well my spaceship).
The reason I'm doing this is because the bullet then starts at the spaceship and then (once I code it) it will move upwards until it hits the enemies.
Lol I feel retarded, this is such a simple problem but my brains dead :/
public class Bullet extends MyActors
{
public void act()
{
if(Greenfoot.isKeyDown("space")) {
fire();
}
}
public void fire()
{
Space.addObject(new Bullet(), (Spaceship.getX()), (Spaceship.getY()));
}
}Non-Static method getX() cannot be referenced from a static context


