Jun-25-2020, 08:13 PM
As GOTO10 said, without knowing what your game is, specific help is impossible.
With pygame, this is how I time random things in my games (mostly, enemies to shoot at random intervals).
With pygame, this is how I time random things in my games (mostly, enemies to shoot at random intervals).
random_chance_role = pg.random.randrange(1000) if random_chance_role < 5: do_random_thing = True # OR whatever your game requiresThis will give you a .5% chance / frame. You can change the numbers to suit your needs.