views:

156

answers:

3

Hi..I made shoot em up like game.But I have only one ememy which fallows me on screen.But I want to make lots of enemys like each 10 second they will across on screen together 5 or 10 enemys.

 ArrayList<Enemies> enemy = new ArrayList<Enemies>();

 for (Enemies e : enemy) {

        e.draw(g);
    }

is it good creating array list and then showing on screen? And Do I have to make some planing movements thoose enemies in my code ? I want that they vill appear not on same pozition.Like First 5 enemies will come top of screen then the other 5 or 10 enemies will come from left side.. so on.What is best solution for this?

And I have problem where to fullfiel this array like

enemy.add(new Enemies(750,60)) 

But this doesnt work ((

A: 

Yes you can create an ArrayList for enemies, it's a common solution.

LucaB
A: 

You can randomize the starting position ofthe enemies using the Random class. At the point where you create the enemy select Random coordinates for each.

You may want to have each enemy run in its own thread so that they move independent of each other too.

Vincent Ramdhanie
+1  A: 

Use for example a random property and onScreen property. And set them when you show them on the screen.