Sign in to follow this  
Grantyt3

Gradius Type Enemy Question

Recommended Posts

Maybe one of you can help me here. In games like Gradius, and actually most space shooters, or other games of that sort, the enemies seem to follow tracks in a way. Like a string of enemies will come out of the sides of the screen and do all sorts of cool synchronized kinds of things. In my previous space shooters, the enemies just bounce arond the screen at random speeds in random directions. How could I achieve what I was talking about? Like this game: It's not just random movement, they follow a coreography, kind of like a ballet, lol.

Share this post


Link to post
Share on other sites
Hi,
If you remove the moving background, a shooter is basically a ship moving and shooting not much different to space invaders.
Then you may create a dancing enemy by tracing some navpoints. Navpoints can be defined as a destination point and a speed to reach that destination. Positions may be absolute or relative.
Can be something simple like:
START -10,0 //that is out of screen
GOTO 100,100,200 //go to 100,100 moving at 200 pix/sec
GOTO 150,200,400 //go to 150,200 moving at 400 pix/sec
WAIT 200 //may tell you to stay there for 200 msecs
GOTO 640,400,800 //go to 640,400 moving at 800 pix/sec

And so on.
Now give each command an ID (like START=1, GOTO=2 or WAIT=3), so you get:
1 -10 0
2 100 100 200
2 150 200 400
3 200
2 640 400 800

Save that into an array inside the enemy (int commandArray[200][4];) and you can process line by line executing each command.

I made once a program that allowed me to create complex navpaths including curves but it was basically the same I explained here.

Luck!
Guimo

[Edited by - Guimo on May 5, 2006 2:02:24 PM]

Share this post


Link to post
Share on other sites
Many enemies in Gradius (eg., the ones in your pic) seem to follow a simple sine wave for their initial attack. Other enemies (like the ones that fly out of those dome-like thingies) fly straight up until their altitute is equal to that of the player, then simply fly in her direction.

Most of the enemies have pre-scripted flight paths, but they will typically diverge from that after the initial wave and just hone in on the player.

Your enemies need to keep track of state, which includes of course their velocity and the flight path their currently flying. Most of the pre-scripted flight paths in Gradius stop either when they reach the player or when they reach the edge (left) of the screen, so their current flight path state predominantly depends on their position as opposed to time - although I would assume a few have time-based choreography.

What language will you be implementing this in?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this