Hello guy I want to know how to shoot bullets from turret in SDL.
How to shoot bullets
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!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement