Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Jan 2008
Offline Last Active Nov 25 2012 08:06 AM

#4839792 Space Shooter, how to handle enemy waves

Posted by on 24 July 2011 - 07:05 PM

Yeah, a timeline structure would be good. Something like this:

var attack_timeline:Array = [   {duration:123, type:"wave",aliens:24} , {duration:43.2,type:"sweep",aliens:19} , {duration:12,type:"wave",aliens:12} ];

You could either store the duration of an attack before the next one or the time the attack would take place, or the distance travelled by the user where the attack would take place or a hotspot which would trigger an attack.

If you want to be especially jammy you could read this info in from an XML file.

Think about all the data that your game needs then think about how you would store it in arrays and structures and so forth. You could set up all these structures before you have even programmed anything!

In terms of programming the wave. You just assign the attack-type to the alien. Then the alien will follow a set time-line like you said depending on it's attack type.
alien[25].attackmode = "wave"