I'm creating a Space Invaders game for a school project and I'm having the issue that when the Aliens reach the worlds edge, only the Alien on the furthest side of the screen will automatically move down closer to the bottom of the world. Obviously, in true Space Invaders fashion, I want the entire class of Aliens to move down.
Here's the code I'm currently using:
Any help is much appreciated!
public void reachWorldEdge() { if (getX() >= 970) { MOVEMENT_SPEED2 = -1; setLocation(getX(), getY() + 30); } if (getX() <= 50) { MOVEMENT_SPEED2 = 1; setLocation(getX(), getY() + 30); } }