class Particle: def __init__(self, x, y, duration, xv = 0, yv = 0): self.x = x self.y = y self.t = duration self.xv = xv self.yv = yv def update(self, time): self.x += self.xv * time self.y += self.yv * time self.t -= duration return self.t >= 0
class ParticleGenerator: def __init__(self, rate): self.particles = [] self.rate = rate self.time_modulus = 0 def update(self, time): # i'd like to check the constant rate logic in this line new_particle_count, self.time_modulus = divmod(time + self.time_modulus, self.rate) for idx, particle in self.particles: