def main(): carWheel = wheel.wheel("car wheel 1", "car", 27) bikeWheel = wheel.wheel("bike wheel 1", "bike", 27) notCar = car.car("Pinto", "Red", carWheel) notBike = bike.bike("Pinto", "Red", bikeWheel) print(notCar) print(notBike)
def main(): global current_step global current_point mybike = bike() alpha = 100.0 changed = False step = 20 doc = parse('breckenridge_5k.tcx') trackpoints = doc.getElementsByTagName("Trackpoint") elements = ('AltitudeMeters', 'DistanceMeters', 'LatitudeDegrees', 'LongitudeDegrees') for tp in trackpoints: obj = {} for el in elements: obj[el] = float(tp.getElementsByTagName(el)[0].firstChild.data) waypoints.append(obj) pygame.init () screen = pygame.display.set_mode ((640, 480), 0, 32) all_route_points = {} all_route_points = StreetView.load_route_points(data_dir, waypoints) current_image = pygame.image.load (all_route_points[current_point]['FileName']).convert() next_image = pygame.image.load (all_route_points[current_point+1]['FileName']).convert() pygame.display.flip () pygame.key.set_repeat (500, 30) usage() going = True while going: for event in pygame.event.get (): if event.type == QUIT: going = False if event.type == KEYDOWN and event.key == K_q: alpha -= step if alpha <= 0.0: alpha = 100 current_point+=1 current_image = pygame.image.load (all_route_points[current_point]['FileName']).convert() next_image = pygame.image.load (all_route_points[current_point+1]['FileName']).convert() changed = True elif event.type == KEYDOWN and event.key == K_w: alpha += step changed = True if alpha >= 100: alpha = 100 current_image.set_alpha(alpha) next_image.set_alpha(100-alpha) screen.blit (current_image, (0, 0)) screen.blit (next_image, (0, 0)) screen.blit (hud.get_hud(mybike), (0,0)) pygame.display.flip () changed = False pygame.quit()
def __init__(self): self.cleanup_mode = True self.dist_step = 90 self.alpha = 255 self.route_points = [300,320,405,233,323,325,343,343,400] self.update = True self.last_time = "" self.elapsed_time = 0 self.start_time = 0 self.end_time = 0 self.running = False self.bike = bike() self.quit = False self.position = 1 self.route = "" self.init = False