Jump to content

  • Log In with Google      Sign In   
  • Create Account

How to shoot bullets


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.


  • You cannot reply to this topic
1 reply to this topic

#1   Members   -  Reputation: 114

Like
0Likes
Like

Posted 01 September 2013 - 10:17 AM

Hello guy I want to know how to shoot bullets from turret in SDL.


Edited by Darpan Sharma, 01 September 2013 - 10:18 AM.


#2   Crossbones+   -  Reputation: 3775

Like
5Likes
Like

Posted 01 September 2013 - 11:18 AM

*
POPULAR

You take the position of the tip of the turret and put the bullet there.

Calculate the vector from the center of the turret to the tip.

Normalize the vector.

Multiply it by an appropriate value for the bullet speed.

Memorize both.

Advance the position every gametick by adding the vector to it (Stop when you hit something or its out of bounds.)

 

PS: As you didnt provide much info I kept it short. Ask if you dont understand something!


Edited by wintertime, 01 September 2013 - 11:26 AM.





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.




PARTNERS