# HG changeset patch # User Josef "Jeff" Sipek # Date 1124408687 18000 # Node ID 61defd11d98c152711e2fbc9beb3e0015d5ee1f8 # Parent faadd33178ba8d5a3bc32d3ce32bd2e16ca487cc Allow usage of different plane types (added parameter) diff -r faadd33178ba -r 61defd11d98c atc_game.py --- a/atc_game.py Thu Aug 18 01:04:47 2005 -0500 +++ b/atc_game.py Thu Aug 18 18:44:47 2005 -0500 @@ -67,7 +67,8 @@ self.screen.blit(self.screen_map, (0, 0)) pygame.display.flip() - self.planes = [atc_plane.Plane(callsign="N12422",flightno="Delta 79",vel=(50, 50, 10)),] + self.planes = [] + self.planes.append(self.__random_plane()] self.weather = atc_weather.Weather() @@ -210,7 +211,16 @@ self.__proc_cmd() return True - + + def __random_plane(self): + callsign = "N1499H" + flightno = "Delta 79" + squawk = "1200" + type = "B747" + vel = (20, 20, 20) # FIXME: use the specs + + return atc_plane.Plane(type=type, callsign=callsign, flightno=flightno, squawk=squawk, vel=vel) + def run(self): if not self.__proc_events(): return False diff -r faadd33178ba -r 61defd11d98c atc_plane.py --- a/atc_plane.py Thu Aug 18 01:04:47 2005 -0500 +++ b/atc_plane.py Thu Aug 18 18:44:47 2005 -0500 @@ -56,7 +56,7 @@ class Plane(pygame.sprite.Sprite): """ Class to manage one plane's motion """ - def __init__(self,callsign,flightno,squawk="1200",pos=(0.0, 0.0, 0.0),vel=(0.0, 0.0, 0.0)): + def __init__(self,type,callsign,flightno,squawk="1200",pos=(0.0, 0.0, 0.0),vel=(0.0, 0.0, 0.0)): """ Set up everything """ pygame.sprite.Sprite.__init__(self) @@ -102,7 +102,14 @@ self.timer = 0 # this is timeout the next time we try to recalculate position # plane specs - self.specs = plane_SPECS[0] # default to a simple prop plane, FIXME: add param to override + self.specs = None + for p in plane_SPECS: + if p['name'] == type: + self.specs= p + break + + if self.specs == None: + self.specs = plane_SPECS[0] # status flag self.status = plane_OK