Working on 2D shooter, need some answers
Hi,
Im working on a 2D top down shooter, much like Ikari Warriors.. For those of you who havent played Ikari Warriors, think of Contra in a Zelda 3 style game but much more action based. Anyways, Ive made a map and a map maker, but now that Im getting into the game I need to keep track of enemies, enemy positions, and bullet shots.. Does anyone have any suggestions for this? Im working in VB...
Thanks,
Jesse Acosta
January 18, 2001 02:23 PM
You could have a type for your baddies and bullets, and some subroutines that update them. For example, a baddie type might look something like this:
Const BADDIE_DEAD = 0
Const BADDIE_IDLE = 1
Const BADDIE_PACING = 2
Const BADDIE_FIGHTING = 3
TYPE Baddie
X As Integer '' X-position in tiles
Y As Integer '' Y-position in tiles
State As Integer '' One of the BADDIE_x constants
''... more data here
END TYPE
Then you could have an array of these:
Const BADDIE_COUNT = 50 '' Number of baddies
Dim BaddieArray(BADDIE_COUNT) As Baddie
(You could also made "BaddieArray" a dynamic array, and load the number of baddies from your level file. Whatever works best)
Then you could have a function that updates and draws a single baddie:
Sub UpdateBaddie(ByVal BaddieIdx As Integer)
'' Checks state of baddie and updates/draws accordingly
End Sub
And do this to update and draw all baddies:
For I = 0 to BADDIE_COUNT
UpdateBaddie(I)
Next I
You could do the same thing for bullets, but it would be easier because you wouldn''t have to worry about AI and stuff.
PS : The ''x'' and ''y'' integers in the "Baddie" type assume you are using a tilebased map. If not they might need to be changed.
- Torin
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement