diff --git a/city.py b/city.py index 004e987..f53305c 100644 --- a/city.py +++ b/city.py @@ -2,8 +2,9 @@ from typing import List, Dict, Tuple from garbageCan import GarbageCan from speedBump import SpeedBump from street import Street -from gameContext import GameContext - +from gameContext import GameContext + + class City: cans: List[GarbageCan] bumps: List[SpeedBump] @@ -18,10 +19,10 @@ class City: def add_can(self, can: GarbageCan) -> None: self.cans.append(can) self.cans_dict[can.position] = can - + def add_street(self, street: Street) -> None: self.streets.append(street) - + def add_bump(self, bump: SpeedBump) -> None: self.streets.append(bump) @@ -33,11 +34,11 @@ class City: def _render_streets(self, game_context: GameContext) -> None: for street in self.streets: street.render(game_context) - + def _render_nodes(self, game_context: GameContext) -> None: for node in self.cans: node.render(game_context) - + def _render_bumps(self, game_context: GameContext) -> None: for bump in self.bumps: - bump.render(game_context) \ No newline at end of file + bump.render(game_context) diff --git a/main.py b/main.py index e1dafa0..721211c 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,6 @@ import pygame + +from city import City from gameEventHandler import handle_game_event from gameContext import GameContext from startup import startup @@ -17,8 +19,11 @@ game_context = GameContext() game_context.dust_car_pil = dust_car_pil game_context.dust_car_pygame = pygame.image.frombuffer(dust_car_pil.tobytes(), dust_car_pil.size, 'RGB') game_context.canvas = canvas + +city = City() + startup(game_context) -collect_garbage(game_context) +collect_garbage(game_context, city) exit = False