Our cycle needs to accelerate at a constant rate until it reaches the throttle setting, or decelerate to the throttle, if necessary. This will take two things to make happen, some new variables and two new methods.
__init__method. Place this code right below the line where we define the
self.speed = 0 self.throttle = 0 self.maxSpeed = 200 self.accel = 25
Worldclass. Add this code to the end of the
Worldclass, right above the line that sets
w = World()
def speedCheck(self, dt): tSetting = (self.maxSpeed * self.throttle) if(self.speed < tSetting): if((self.speed ...