• Create Account

## side scrolling shoot-em up game

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1GliTch  Members

122
Like
Likes
Like

Posted 28 August 2001 - 12:50 AM

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

### #2Shannon Barber  Moderators

1657
Like
Likes
Like

Posted 28 August 2001 - 04:23 PM

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

### #3GliTch  Members

122
Like
Likes
Like

Posted 30 August 2001 - 05:09 AM

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