2022-10-26 21:57:29 +03:00
|
|
|
from settings import *
|
|
|
|
from player import Player
|
|
|
|
from frame import Frame
|
|
|
|
|
|
|
|
|
|
|
|
class Out:
|
2022-10-27 00:29:36 +03:00
|
|
|
def __init__(self, pl: Player) -> None:
|
2022-10-26 21:57:29 +03:00
|
|
|
self.width = WIDTH
|
|
|
|
self.height = HEIGHT
|
2022-10-27 00:29:36 +03:00
|
|
|
self.pl = pl
|
2022-10-26 21:57:29 +03:00
|
|
|
|
2022-10-27 00:29:36 +03:00
|
|
|
def draw(self) -> None:
|
2022-10-26 21:57:29 +03:00
|
|
|
frame = Frame(self.width, self.height)
|
2022-10-27 00:29:36 +03:00
|
|
|
pl = self.pl
|
2022-10-26 21:57:29 +03:00
|
|
|
|
|
|
|
for point in pl.body:
|
|
|
|
frame.draw(
|
|
|
|
x=point.x, y=point.y,
|
|
|
|
value=WALL,
|
|
|
|
width=1, height=1
|
|
|
|
)
|
|
|
|
|
|
|
|
if frame.see(pl.food.x, pl.food.y) == WALL:
|
|
|
|
frame.draw(
|
|
|
|
x=pl.food.x, y=pl.food.y,
|
|
|
|
value=WALL_FOOD
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
frame.draw(
|
|
|
|
x=pl.food.x, y=pl.food.y,
|
|
|
|
value=FOOD
|
|
|
|
)
|
|
|
|
|
|
|
|
frame.show()
|
2022-10-27 00:29:36 +03:00
|
|
|
print(f"Score: {pl.score}")
|