Advertisement

Galaga - alien ship flight paths

Started by August 30, 2000 06:49 PM
1 comment, last by gumball 24 years, 3 months ago
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!
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
Advertisement
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.

This topic is closed to new replies.

Advertisement