streets_rendering #14
25
street.py
Normal file
25
street.py
Normal file
@ -0,0 +1,25 @@
|
||||
from enum import Enum
|
||||
from typing import Tuple
|
||||
from gameContext import GameContext
|
||||
|
||||
class StreetType (Enum):
|
||||
VERTICAL = 0
|
||||
HORIZONTAL = 0
|
||||
|
||||
class Street:
|
||||
street_type: StreetType
|
||||
start_cell: int
|
||||
end_cell: int
|
||||
row_or_column: int
|
||||
|
||||
def __init__(self, start_cell: int, end_cell: int, row_or_column: int, street_type: StreetType = StreetType.VERTICAL) -> None:
|
||||
self.start_cell = start_cell
|
||||
self.end_cell = end_cell
|
||||
self.street_type = street_type
|
||||
self.row_or_column = row_or_column
|
||||
|
||||
def render(self, game_context: GameContext) -> None:
|
||||
for i in range(self.start_cell, self.end_cell):
|
||||
img_str: str = 'imgs/street_vertical.png' if self.street_type == StreetType.VERTICAL else 'imgs/street_horizontal.png'
|
||||
cell: Tuple[int, int] = (i, self.row_or_column) if self.street_type == StreetType.VERTICAL else (self.row_or_column, i)
|
||||
game_context.render_in_cell(cell, img_str)
|
Loading…
Reference in New Issue
Block a user