Jump to content
  • Advertisement
Sign in to follow this  
NickyP101

2D Top Down Shooter Question

This topic is 4900 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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!