<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, td):

 """Update state of ball"""

        self.sprite.last_position = self.sprite.position
        self.sprite.last_velocity = self.sprite.velocity
        if self.particle_group != None:
            self.update_particle_group(td)