I got everything else for the game but for some reason the Aliens won't move at all. Is my code completely wrong?
public class Alien extends Actor
{
protected int delayCounter; //Counts cycles.
protected int counter; //Another counter variable.
public int modulus; // make aliens move.
public boolean first; //first move cycle then true.
public boolean Left; // Alien movement to the left = true.
/**
* Allows the Alien to be destroyed by shooter bullet.
*/
public void act()
{
Actor bullet = getOneIntersectingObject(Bullet.class);
if(bullet != null)
{
getWorld().removeObject(this);
}
delayCounter++;
}
/**
* Allows the Alien to shoot
*/
public void shoot ()
{
getWorld().addObject (new AlienBullet(), getX(), getY());
}
/**
* Where each veriable is set.
*/
public Alien()
{
delayCounter = 0;
Left = true;
modulus = 20;
counter = 0;
first = true;
}
/**
* This method tells the Alien how to move
*/
public void move()
{
counter++;
if (counter < (20 * modulus) && first) //Go left if counter is less than 400
{
moveLeft();
}
else if (counter < (35 * modulus) && !Left && !first ) //Go right if counter
//is less than 750 and
{
moveRight();
}
else if (counter < (35 * modulus) && Left && !first ) //Go left if counter is
//less than 700
{
moveLeft();
}
if ( counter == (35 * modulus) ) //Tells the aliens to move down
{
moveDown();
counter = 0;
Left = !Left;
}
else if (counter == (20 * modulus) && first) //Tells the aliens to move down
//once it hits the left edge of te world
{
moveDown();
first = false;
counter = 0;
Left = !Left;
}
}
/**
* This Tells the Aliens to move left
*/
public void moveLeft()
{
if ( (delayCounter % modulus) == 0)
{
setLocation(getX()-10, getY());
}
}
/**
* this tells the aliens how to go right
*/
public void moveRight()
{
if ( (delayCounter % modulus) == 0)
{
setLocation(getX()+10, getY());
}
}
/**
* This shows the aliens how to go down
*/
public void moveDown()
{
setLocation(getX(), getY() + 10);
}
}