Sign in to follow this  
Johnell

Create enemies in 2D side-scroller

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this