Mercurial > atc
changeset 38:61defd11d98c
Allow usage of different plane types (added parameter)
author | Josef "Jeff" Sipek <jeffpc@optonline.net> |
---|---|
date | Thu, 18 Aug 2005 18:44:47 -0500 |
parents | faadd33178ba |
children | df8a24a74ff4 |
files | atc_game.py atc_plane.py |
diffstat | 2 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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