#### Archived

This topic is now archived and is closed to further replies.

# side scrolling shoot-em up game

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

## Recommended Posts

dude, I''m trying to make a side scrolling shoot-em up game, so far I got a sprite A (player) and sprite B (enemy) on the screen (moving). Can someone help me on how to calculate the x,y co-ordinate of a bullet fired by sprite B to hit sprite A. My ideas is to get the x,y co-ordinate of both sprites when sprite B try to hit sprite A and use y=mx+c (a straight line equation) some how?? Also, any help on how to calculate a homing missle. any help will be welcome, thanks dude.. GliTch

##### Share on other sites
Use vectors, it greatly simplifies everything.

y=mx+c won''t work if the two object are right above/below each other for starters...

You need to decide how fast the bullets move, then you set the bullet''s initial position to the position of sprite A, and set the bullet''s direction vector equal to the sprite''s motion vector. Then every frame multiply the bullet''s velocity vector by the elapsed time and add it to it''s position.

Magmai Kai Holmlor
- Not For Rent

##### Share on other sites
I got a maths book at the library, and I'm not quite sure how to apply vectors...

thanks

Edited by - GliTch on August 30, 2001 1:56:35 PM