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.

DarkBASIC Professional Discussion / How do you code formations and patterns (Galaga)?

Author
Message
zenassem
22
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 19th Dec 2008 23:28
Can anyone explain to me how one would code/create a formation pattern editor for shooter games. One game that comes to mind is Galaga. I'm not asking for the code as much as the theory.

In galaga the enemies came flying in in squadrons, and then after running their pattern they would fall into a more general formation. Then enemies would drop out of the formation and run patterns to attack the player. How does one go about setting this up?

I had 2 thoughts.

#1 create an editor, and drag and drop enemies. Then to create the patterns use waypoints (or keyframes), and then code the engine to do the tweens for each sprite to smooth out the pattern.

#2 My second idea was to draw lines, like spline paths, and have the sprites/objects follow the spline paths.

I'm sure there are easier geometric solutions, using sin cos tan to create swirling patterns but I just don't get how to do it, or how to write an editor to create new and interesting patterns for levels.

Dragon Knight
18
Years of Service
User Offline
Joined: 10th Jan 2007
Location: Newcastle
Posted: 20th Dec 2008 00:44 Edited at: 20th Dec 2008 00:46
This reminds me off when i was creating an RTS, this part was the most simplistic

When moving, you get the point in which you want them to move, and re-arrange the formation to suit what you want.

E.g. you want them to go to the top screen so you'd pick the middle top.

From this point you do a for loop from 1 to max enemies and from there position them accordingly.

Depending on what formation you want you could make hundreds depending on how well you code .

THUS everyunit could have a way point from the formation results , and just move them to it. If you were to add collision between them this can make difficulties as i found out, but in general if you add some nifty code for movement this can get around that problem.

Hope that helps, if you want more info feel free to ask in more specific areas and i'll try help.

----------------------------------
http://www.hybridwolves.co.uk
----------------------------------

Login to post a reply

Server time is: 2025-05-20 04:37:30
Your offset time is: 2025-05-20 04:37:30