Top-down shooter.

Started by
12 comments, last by Llew 24 years ago
Well, actually, I was going to make something like that. Except I was thinking of something more like this:

You specify the starting point on the world map. You specify the sprite. Then you do something like this:

int x = x_start_coordinate;
int y;//y path


//in main loop
y = x^2 + 5;

//update the ship''s position
moveship(x, y)

//every 150 y coordinates
if(y %150 == 0)
{
//this function would make the sprite shoot at
//the user''s ship
shoot(&sprite);
}

or something like that.


"Remember, I'm the monkey, and you're the cheese grater. So no messing around."
-Grand Theft Auto, London

"It's not whether I win or lose, as long as I piss you off"
-Morrigan, Super Puzzle Fighter II Turbo
D:
Advertisement
Here''s my little piece of advice, AFAIK division is the slowest operation for a CPU. So don''t use %,/ or \ too much. Especially for EACH sprite in your game loop. Of course I could be wrong, so anyone?

-------------------------
-Now Working on Pokemon like Engine!
-------------------------
-Now Working on Pokemon like Engine!
quote:Original post by Marauderz

Here''s my little piece of advice, AFAIK division is the slowest operation for a CPU. So don''t use %,/ or \ too much. Especially for EACH sprite in your game loop. Of course I could be wrong, so anyone?


You''re almost right. Those operations are slow, but not that slow. Using them on a per-sprite basis is almost always ok. It''s when you use them on a per-pixel or per-vertex basis that you want to look into optimising them out. Remember - such optimisations should be left until you know you need them! As cleaner code is of more use to you in the meantime.
In my recent project I store the ship path as vertex points. These points are then used to calculate a linear, quadratic, or cubic spline. I realize these methods aren''t the fastest but they give the smoothest possible movement and are VERY easy to design!

This topic is closed to new replies.

Advertisement