Skip to main content
GameDev.net gamedev.net
🔒 Locked

Asteroid/spaceship logic

Started by boolean010 Apr 25, 2000 at 1:15 AM 5 replies 600+ views
Original Post
boolean010
boolean010
I''m trying to make a game where I have about 15 asteroids and a spaceship that has the ability to destroy asteroids. What would be a reasonably algorithm to use where I could have the asteroids attack the spaceship while giving it a chance to destroy the asteroids without being too easy.
** boolean010 **
JonatanHedborg
JonatanHedborg
What do you mean?

Do you need to know how to make the asteroids move or what?

(Sorry if i sound angry, im not. im only tired)

========================
Game project(s):
www.fiend.cjb.net
================<FONT COLOR="#850000
boolean010
boolean010
I know how to move the asteroids around, but what I''d like to do is have the asteroids appear as if the had some grudge against the spaceship without destroying it instantly.
** boolean010 **
JonatanHedborg
JonatanHedborg
You could spawn them outside the screeen, making them head for the player (So that if the player doesent move, he gets killed).




========================
Game project(s):
www.fiend.cjb.net
================<FONT COLOR="#850000
lpsoftware
lpsoftware
Just adding to the anon poster's logic with the asteroids "seeking the human" according to different levels of difficulty. You could make the asteroids seek the ship by doing some simple calculations.


if (ship.x < enemy.x)
enemy.x--;

else if (ship.x > enemy.x)
enemy.x++;

Pretty self-explanatory. You probably won't need to do any y calculations since the asteroids will always be traveling in a downward fashion, so you'd keep on adding to the y coordinates.

Martin

Edited by - lpsoftware on 4/26/00 11:55:53 AM
______________Martin EstevaolpSoftware
boolean010
boolean010
Thanks to everyone for their suggestions. Using the information that I''ve gathered, I will attempt to make my very first game in mode0x13(I know that mode13 is dead, but at least I won''t have to worry about the details of setting up directdraw ).
** boolean010 **

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.