• Advertisement
Sign in to follow this  

Create enemies in 2D side-scroller

This topic is 1762 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

What is the best way to create enemies in a tile based side-scroller game? I can think of 2 different ways. Either manually place enemies on the tilemap or random their position. 

 

If I random their position I have to check for collision. If I manually place them I can make sure they never collide with an object. What's the best way to do this?

 

I am using http://www.mapeditor.org/ to create my tilemap.

Share this post


Link to post
Share on other sites
Advertisement

It really depends on the type of game you want to make, but, typically, the enemies are pre-set in the map.  So, you would simply put where the enemies are on the map, and go.

 

If you want to randomize, which may be a viable option, yes, you'd have to check:

1) there's a place for the enemies to stand (ie, not a hole the enemy would just fall into, unless they fly).

2) there's no object or enemy already there

 

Good luck.

Share this post


Link to post
Share on other sites

If you do want random enemy placement then the best option would be to have a list of predefined locations that would be selected from randomly. This way you can avoid having enemies spawn in weird locations.

Share this post


Link to post
Share on other sites

You can do a hybrid where you have set areas where you want an enemy to show up, but make the location random.  Enemy placement, imo, is a big factor when it comes to level design.  You don't want complete randomness.  This way, you can have your enemies located in a certain area based on how you build your level, but the exact location will be random to make each play through a little different.

Share this post


Link to post
Share on other sites

Also,  you could do a "Gauntlet, Dark Legacy" style where there are spawners that you can destroy. As long as the spawner is alive and you are near it, then enemies will spawn. 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement