• Advertisement

Archived

This topic is now archived and is closed to further replies.

Galaga - alien ship flight paths

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

Hi all, What are your thoughts on how the flight paths for enemy ships in Galaga/Galaxians etc are created and used? I only have a couple of ideas but they don''t seem particularly clean. i. 2d array matching the screen with some value representing the ship position at a particulat time ii. list (linked list or array) of co-ordinates which are simply stepped through to get the new position of the ship each frame iii. some kind of movement templates that store position deltas - you join a couple of templates up to create a flight path, then use the delta values to update the ship position. If anyone knows how it should be done or just has an idea, let me know!

Share this post


Link to post
Share on other sites
Advertisement
Here's how I did it:
In my level editor, you choose between four flight patterns (sweep, straight, zig zag and L-shaped). Then you choose a distance vertically to fly until the pattern starts, and a distance horizontally for the patterns to do. Then, in the code, based on the selected pattern, a movement function moves them in that pattern by modifying the vertical and horizontal velocity (using vector motion, basically). It just tests the distances traveled and the current speeds and stuff and modifies the vectors accordingly. Email me if you want some sample code or something.

Edited by - Qoy on August 31, 2000 3:27:25 AM

Share this post


Link to post
Share on other sites
Thanks Qoy,

I have decided to use Bezier Curves for the flight paths - I will create some Bezier Curve control point templates

eg. Point1.x = ?
Point1.y = ?

Point2.x = Point1.x + 20
Point2.y = Point1.y + 20

Point3.x = Point1.x - 30
Point3.y = Point1.y + 30

Then to create new paths I can just set the starting point (Point1)

Then throughout the game I will make the bezier curve calculations and update the alien position accordingly.

Share this post


Link to post
Share on other sites

  • Advertisement