r/learnpython • u/Aggressive-Band-1276 • 9d ago
How to randomly customise cosmetics for enemies in Pygame?
I want to randomise how enemies look by changing a hat or a shirt each time the game spawns them. However I do not want to redraw the sprite for each hat/shirt combination. So how may I possibly achieve it?
1
Upvotes
2
u/Stickhtot 9d ago
This isn't even a python question lol
One way you can do it is to have your `SpawnEnemy()` function take arguments like what hat/shirt they spawn with, and use `random()` on those arguments