# How to generate moving schemes for sprites

This topic is 2838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

[color="#323D4F"]Hi,

Do you know a very old game called Galaga ? It's a shoot'em'up in which enemy waves come from the top of the screen, and make a few loops before adding to the ranks at the top with the others.
[color="#323D4F"]
I'm developing a clone of that game for Android, and I wonder if there's a tool or a method I could use to generate the coordinates used for these loops of my enemy sprites.

You can see this game here : http://jeu.info/galaga-flash.html

##### Share on other sites
Well, what you could do is before a group of enemies spawns in, you could randomly generate a list of actions that they will perform before being added to the front line (move in a straight line for distance d, arc at radius for d...). Then use a few algorithms to create a vector of coordinates that the enemies move along based on their speed.

Bresenham's algorithms:
http://free.pages.at/easyfilter/bresenham.html

You should be able to adapt those to your needs (and I'm sure you could find more on google). You could also use sin and cos to create some movement. Good luck!

##### Share on other sites
Make a few parametric curves from out-of-screen spawning points to somewhere in front of the rank. If a group of places is free, decide to spawn a group of enemies. Select one of the curves. Generate one enemy at a time at the spawning point end of the curve, and let it follow the curve with a given speed. For each enemy reaching the end of the curve, detach it from the curve and let it fly along the (perhaps straight) line from the curve's end to its target position.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 11
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633723
• Total Posts
3013541
×