Jump to content
  • Advertisement
Sign in to follow this  
ryan554

Enemies in Scrolling Space Shooter

This topic is 4370 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am relativly new to game programming, I have started several projects but somehow I never finish them. I am hoping to finish the vertical scrolling shooter I am working on. I am not sure how I should deal with the enemies. Should I draw them randomly? Store them in an array the size of my map? Or is there another, better way? Thanx in advance.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Well, what I did for my game (wasn't a side-scroller, but same principle should still work), is I had an array of a monster class, and the monster class itself held the X and Y coords of the monster, along with other stuff.

Share this post


Link to post
Share on other sites
Well, what I did for my game (wasn't a side-scroller, but same principle should still work), is I had an array of a monster class, and the monster class itself held the X and Y coords of the monster, along with other stuff.

Share this post


Link to post
Share on other sites
Hi,

I did a side scrolling before, what I did :
As said you hold a link list of the monster. It is more a queue. You have an active list of active ennemy. When it goes out (bottom) you simply delete it.
And, you know what is the next monster in the queue to popup at the top. You just compare :
if (firstInQueue->Y < levelPosition)
Then, you pop this element from the queue and put it in the active list, and check the next one in the list each time.

Share this post


Link to post
Share on other sites
I made a horizontal side scroller,but you can use the same idea here. What i did was on my map file, set coordinates of where the enemies would appear, and how many. Then I would save those coordinates in an array. Then whenever i would move forward, just check to see if i hit an spot where enemies should appear. If so, make them do their thing :P.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by tont
I made a horizontal side scroller,but you can use the same idea here. What i did was on my map file, set coordinates of where the enemies would appear, and how many. Then I would save those coordinates in an array. Then whenever i would move forward, just check to see if i hit an spot where enemies should appear. If so, make them do their thing :P.


hmmm kind off like hotspots.... I like that idea.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by tont
I made a horizontal side scroller,but you can use the same idea here. What i did was on my map file, set coordinates of where the enemies would appear, and how many. Then I would save those coordinates in an array. Then whenever i would move forward, just check to see if i hit an spot where enemies should appear. If so, make them do their thing :P.


I would expand that a little and have a distance travelled before each new wave of enemies appeared. You would define each wave using things such as number of enemies, formations, movement paths and AI behaviours.

e.g.

class EnemyWave
{
explicit EnemyWave( ... )
{
...
}

private:
int m_startPosition;
int m_numShips;
Formation m_formation;
MovementPath m_movement;
AIBehaviour m_AI;
}

Share this post


Link to post
Share on other sites
Hidden
I think the "classic" space shooter spawns mobs in "waves", rather than from pre-defined positions on a map. I don't think those old-school shooters use any kind of map-file/map-array at all. They just have a scrolling background (to make it look like you're flying in space), and when you've cleared a wave of monsters a new one spawns a few seconds later. The good thing with this method is that you can spawn endless waves of monsters without the program taking much memory or diskspace. If you go for a mapfile technique instead, be prepared, 'cause the map will have to be very, veeeeeery long if the level is gonna be interresting. Good luck!

Share this post


Link to post
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!