• Advertisement
Sign in to follow this  

2D Top Down Shooter Question

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

When the player clicks the mouse button to shoot, it gets the xy co-ords of the player and xy xo-ords of the place clicked on the screen. Finds the gradient of that line, add 1 to x and m to gradient every frame. How can i set a speed of the bullet, lol they move lyk turtles atm, i would lyk almost real tym bullet speed, but i need them to go through each point so i can check if it hits a tree or something. Ne hints from previous experience? Cheers, Nick

Share this post


Link to post
Share on other sites
Advertisement
You don't need to move the bullets 1 px every frame. You can move the bullets 1 px at a time, ten times per frame

for( ctr=0; ctr < 10 ; ctr++ )
//check collision
//move n pixels

Share this post


Link to post
Share on other sites
Hahaha awsome :) I did have that idea, but i thought it might have performance costs? Or is this a very common method?

Share this post


Link to post
Share on other sites
For such a simple calculation it wont have any repercushions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement