Hello guy I want to know how to shoot bullets from turret in SDL.
Edited by Darpan Sharma, 01 September 2013 - 10:18 AM.
Jump to content
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
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.
Posted 01 September 2013 - 11:18 AM
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.
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.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.