Results 1 to 4 of 4
Thread: Survival wave game
- 12-02-2011, 05:10 AM #1
Member
- Join Date
- Nov 2011
- Posts
- 12
- Rep Power
- 0
Survival wave game
Hi all, I'm making a simple wave based survival game for a programming class and I'm having a bit of trouble, heres some background: I've chosen Velociraptors as my basic attacker in the game i.e. what you need to kill to advance to the next wave, and of stuffed a bunch of them into an array, what I want is to spawn the second wave after the first is completely eliminated, heres my code to do so:
this initiates the first wave:
this is supposed to initiate the second waveJava Code:for (int i=0; i<5; i++) { if(raptors[i].isAlive==true) { g.drawImage(raptorPic,raptors[i].xpos,raptors[i].ypos,this); } } for (int i=0; i<5; i++) { if(raptors[i].isAlive==true) { raptors[i].move(); } }
The problem is after a single raptor from the first wave dies, the second wave is instantly drawn and moved, obviously I need every object in the first wave to die before the second wave spawns, any help would be appreciated, thanks in advance.Java Code:for (int i=0; i<5; i++)//draw wave 2 { for (int x=5; x<15; x++) { if(raptors[i].isAlive==false&&raptors[x].isAlive==true) { g.drawImage(raptorPic,raptors[x].xpos,raptors[x].ypos,this); } } }//end of draw wave 2 for (int i=0; i<5; i++)//move wave 2 { for (int x=5; x<15; x++) { if(raptors[i].isAlive==false&&raptors[x].isAlive==true) { raptors[x].move(); } } }//end of move wave 2
- 12-02-2011, 05:21 AM #2
Re: Survival wave game
Use a List instead of an array. When a raptor is killed remove it from the List. When the List is empty call the second wave.
- 12-02-2011, 05:33 AM #3
Member
- Join Date
- Nov 2011
- Posts
- 12
- Rep Power
- 0
Re: Survival wave game
That sounds a lot simpler than my array, unfortunately, I have no idea how to use a list, and although I'm sure I could easily find a guide online, I need an array in the game as a requirement for my project.
- 12-02-2011, 06:07 AM #4
Similar Threads
-
Large Wave Files
By dane1193 in forum New To JavaReplies: 2Last Post: 02-18-2011, 10:59 PM -
Need help with Drawing Sound Wave
By zit1343 in forum Java AppletsReplies: 1Last Post: 02-14-2011, 02:16 AM -
Creating a Triagular Wave in Java
By locorecto in forum Java AppletsReplies: 1Last Post: 03-08-2010, 07:22 AM -
Playing multiple wave files one after the other
By Pals in forum New To JavaReplies: 4Last Post: 02-26-2010, 03:18 AM -
Wave Sounds
By Doctor Cactus in forum New To JavaReplies: 2Last Post: 10-22-2008, 01:44 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks