dodany A* - coś jeszcze nie działa
This commit is contained in:
parent
311a2d0757
commit
af32df4474
15
city.py
15
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)
|
||||
bump.render(game_context)
|
||||
|
7
main.py
7
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user