We already have rudimentary throttle control, in that we can set the throttle to maximum forward or maximum reverse, but we need finer control than that for our game. We'll create a new method for this:
cycleControl()method, add a new method that looks like the following code:
def adjustThrottle(self, dir, dt): if(dir == "up"): self.throttle += .25 * dt if(self.throttle > 1 ): self.throttle = 1 else: self.throttle -= .25 * dt if(self.throttle < -1 ): self.throttle = -1
else: self.throttle = 0
adjustThrottle()method. Change the line ...