Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

How to shoot bullets

4: Adsense

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 Darpan Sharma   Members   

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 wintertime   Members   

4072
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.