2D Top Down Shooter Question

Started by
2 comments, last by Easca 19 years, 1 month ago
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
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
Hahaha awsome :) I did have that idea, but i thought it might have performance costs? Or is this a very common method?
For such a simple calculation it wont have any repercushions.

This topic is closed to new replies.

Advertisement