Shooting in pygame, rotating | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Shooting in pygame, rotating

I want to shoot where my ship is looking, with pygame. Give me examples please. I already did my ship look to the mouse position. I also want to shoot where the mouse is.

18th Aug 2019, 9:26 PM
Artur Spain 🇪🇸
1 Answer
+ 1
I havent used pygame but just find the cords of the mouse and when the command to fire happens(mouse click or space bar.... and so forth) you make a new sprite and animate it at x speed towards the mouse cords. Make sure the bullet sprite is rotated the same amount as the ship.
19th Aug 2019, 12:40 AM
Ole113
Ole113 - avatar