Java spawn multiple seperate enemies from the same class
<p>Hello I am making a Game in Java, and I have an enemy class. I put 10 enemies in an ArrayList, and I draw them.  The problem I am having is that they all spawn on the same spot, and move together.  I want them to be separate entities and move randomely (I have programmed the random movement).</p>

<p>Can anyone help please?</p>

<p>Here is some code</p>

<pre><code>package aitest;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.lang.Math;
public class Zombie {
    //Calling all classes
    private Human human;
    private Global global;

    // Protected variables can only be seen by the package, classes, and subclasses
    // Sprite (X, Y) location
    public static int x, y;

    //Node location
    protected int nodeX;
    protected int nodeY;
    protected int sightRange = 500;
    // Amount of moves for each update
    protected double dx, dy;

    //Move speeds
    protected int walkSpd = 1;
    protected int runSpd = 3;
    protected int spd = walkSpd;
    protected int limitVector;
    // Controls the human movement (used for boundary control right now)
    private boolean canmove = true;
    private boolean changeDir = true;
    private int changeDirTime = 20;
    private int ranLimit;

    private static double XSTEP = 1;
    private static double YSTEP = 1;

    // Timing
    private int time;
    private int timeMax = 60;
    BufferedImage sprite;
    int zombieSpriteSize = 8;
    private static int offSetFrameX;

    public void setImage(int x) {
        BufferedImageLoader loader = new BufferedImageLoader();  
        BufferedImage spriteSheet = null;  
        try {   
            spriteSheet = loader.loadImage("/aitest/Sprites/Zombie/zombie_walk_strip.png");
        } catch (IOException e) {   
            e.printStackTrace();  
        }  
        SpriteSheet ss = new SpriteSheet(spriteSheet);  
        sprite = ss.grabSprite(x, 0, zombieSpriteSize);
        //System.out.println("offSetFrameX: " + x);
    }  

    public Zombie(int x, int y) {

        this.x = x;
        this.x = y;
        dx = x;
        dy = y;
        /*
         * --We create the class for Loading the Image
         * --Make our spritesheet into a BufferedImage
         * --See if we can load the file
         * --  if (can_load == true) {
         *        awwww yisssss
         *        } else {
         *        System.out.println("A MEGGA BUTT TONNE OF ERRORS");
         *     }
         * -- Set the dimension of the sprite
         * WARNING:
         *    in (sprite = ss.grabSprite(0, 0, 50, 50);)
         *    Change the 50, 50 to your sprite size otherwise
         *    get ready for a butt gallon of never ending
         *    errors that will flood your console and make you
         *    go WTF?!?!?!?!?!?!?!?!?!?!?!?!?
         */
        setImage(0);
        System.out.println("A Zombie has appeared!");
        //System.out.println("My X and Y are: " + x + "," + y);
    }


    /*
     * Return the sprite so that in our Board Class
     * we can say "g2d.drawImage(sprite, blah, blah, hurr, hurr, shoop, whoop);"
     */
    public BufferedImage getImage() {
        return sprite;
    }
    public void move(){
        double slope, rise, run; //MATH

        x = (int) Math.ceil(dx);
        y = (int) Math.ceil(dy);


        if (offSetFrameX == 56){offSetFrameX = 0;}
        offSetFrameX += zombieSpriteSize;
        setImage(offSetFrameX);

        double distToHuman = global.distToObject(x, y, human.getX(), human.getY());

        if (distToHuman &lt;= sightRange){
            YSTEP = human.getY() - y;
            XSTEP = human.getX() - x;
            if (Math.abs(YSTEP) &gt; 1) { 
                if (human.y &lt; y) {dy -= spd;}
                else {dy += spd;}
                }
            if (Math.abs(XSTEP) &gt; 1) {
                if (human.x &lt; x) {dx -= spd;}
                else {dx += spd;}
                }
            //System.out.println("The human is clsoe!");
            //System.out.println("dx: " + dx);
            //System.out.println("dy: " + dy);       
        }    
        else {
            time++;
            if (time == changeDirTime) {changeDir = true;}
            if (time == timeMax) {time = 0;}
            if (changeDir == true) {
                ranLimit = 1 + (int)(Math.random()*2);
                if (ranLimit == 1){XSTEP = (int)(Math.random()*3) - 1; YSTEP = (1 + (int)(Math.random()*20) - 10)*0.1;}
                else if (ranLimit == 2){YSTEP = (int)(Math.random()*3) - 1; XSTEP = (1 + (int)(Math.random()*20) - 10)*0.1;}
                changeDir = false;
                changeDirTime = 30 + (int)(Math.random()*((60-30)+1));
            }
            if (YSTEP == 1){dy += spd; dx += XSTEP;}
            if (YSTEP == -1){dy -= spd; dx += XSTEP;}    
            if (XSTEP == 1){dx += spd; dy += YSTEP;}
            if (XSTEP == -1){dx -= spd; dy += YSTEP;}
        }

        if (x &gt;=  Frame.screenX - sprite.getWidth()) {         
            canmove = false;           
            x -= XSTEP;       
        }
        if (x &lt;= 0 - sprite.getWidth()){
            canmove = false;
            x += XSTEP;
        }
        if (y &lt;= 0 - sprite.getHeight()) {
            canmove = false;
            y += YSTEP;
        }
        if (y &gt;= Frame.screenY - 70) {
            canmove = false;
            y -= YSTEP;
        }
        else {
            canmove    = true;
        }

    }
    public static int getX() {
        return x;
    }
    public static int getY() {
        return y;
    }


}
</code></pre>
