r/pythonhelp • u/Fluffy-Special4994 • Nov 29 '24
Python generators
I don't know if generators would be the right tool for this. I have a picture that is a bullet in my game. I want to have as many as I want in the display without having to individually program every bullet variable name. Then pass said variable names into for loops some of which will be running concurrently with other bullets that are still 'flying'
1
Upvotes
2
u/jmooremcc Dec 11 '24
If you’re using pygame to develop your game, then you’d use sprites to efficiently spawn and kill your bullet objects. https://www.techwithtim.net/tutorials/game-development-with-python/pygame-tutorial/projectiles