side scrolling shoot-em up game

Started by
1 comment, last by GliTch 22 years, 7 months ago
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
Advertisement
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
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I got a maths book at the library, and I'm not quite sure how to apply vectors...

could you expand your explanation, please...

thanks



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

This topic is closed to new replies.

Advertisement