Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Placing enemies for 2d shoot'em up

Author
Message
Tribasic
20
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 2nd May 2006 06:24
Hi Everyone,

I'm trying to make a top down 2d shoot'em up. So far, things are going quite well. (thanks to this useful forum...)

I'd like to know what is the best way to place the enemy spaceships?

I did a test and basically combined my enemy placement with my tile editor. So in my game, whenever we encountered let's say, tile 10, my program would place an enemy ship, and run that ships attack wave routine. And I assigned different tile numbers to different ships. And those ships would run through their repective routines.

This is my first time programming, so I don't have any experience as to the proper way to place my enemies. I would like to know if this is a good way of working before I get too far into it.

One good point is, it's an easy way to set up where my enemies will appear. But, I think this method may be limiting because, if my screen was 10 tiles wide, I would only be able to place 10 of the same ship across the screen. I might want to have 50 of those ships going across the screen. (although i think people would stop playing my game if I used 50 ) But I hope you can see my point.

What do you guys think is the best way to place enemies in a 2d shooter?

Thanks,

TriBasic
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 3rd May 2006 09:31
maybe an idea like this, not using an editor but doing things procedurally

create a variable and store the screen width
rem Screen Width
ScrW = Screen Width()

for this example lets just say 800
ScrW = 800

now on the first wave your going to have say 5 enemies.

rem Max Enemies
MaxE = 5



Divide the amount of enemies to the screen width

SpaceResult = ( ScrW / MaxE )

this will give you a spacing result eg: 160
this way you could write a loop using maxE as the maximum of your loop
and place them accordingly by multiplying the SpaceResult each loop.
this will place them in a neat row with even spacing.
as the levels increase you can increase the max enemies and the program will handle the rest of the positioning for you.

If no-one gives your an answer to a question you have asked, consider:- Is your question clear.- Did you ask nicely.- Are you showing any effort to solve the problem yourself 
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd May 2006 11:31
You need to make the waves, and patterns of the enemy flight paths. Then make a button for each one with a little picture to demonstrate it. The picture can be made by pressing print screen, then scale that down to fit on a button. Then it's best to be able to scroll your map up/down, click the button for the pattern, and click the mouse on the screen to place it. Put a little sprite there of a coloured dot which can be deleted if you require. Each dot would be a different colour for each type of wave pattern. When the dot is placed you would store the X/Y position in an array, and the pattern number. Later, save the array, and load it into the game.

Tribasic
20
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 3rd May 2006 17:02
Awesome!

Thanks. I'm going to incorporate both of your ideas into my program.

My biggest problem a the moment is creating enemy flight patterns. So far,I have made the standard Sine wave and 'Classic' straight line patterns . Actually, I must admit that making the flight patterns is more challenging than I thought it would be.

Anyway, I've started creating attack wave patterns using a different method. I got the idea from some code that Pizzaman posted about making an enemy shoot bullets at the mouse pointer. Instead of using his useful code for homing missles, I've decided to use it to make different waypoints for my enemy ship. So once the ship makes it to one destination, it will update the waypoint, then travel to the next coordinates. Works really well. Although the difficult part semms to be having the ships make a smooth transition from waypoint to waypoint. I'm looking forward to messing around with it after work.

Thanks again for your input!!!

TriBasic
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 4th May 2006 00:17
I think there was something in the last newsletter about making enemy formations using boxes. It was very interesting.

Tribasic
20
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 4th May 2006 00:36 Edited at: 4th May 2006 00:57
Thanks for the tip Pincho Paxton!

I always forget to check the newsletters for info.

I'm reading the article now, and it's really interesting. I like it because this approach doesn't rely on all kinds of complicated math formulas. Math was never my strongest subject.

I also found a neat link to a shoot'em forum in an older newsletter.
http://www.shmup-dev.com

I should check these newsletters more often!!

Login to post a reply

Server time is: 2026-07-04 13:25:56
Your offset time is: 2026-07-04 13:25:56