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