adjust to changes in env, const and field
This commit is contained in:
parent
e84a93580e
commit
631a0d32e5
@ -29,6 +29,6 @@ class GameUi:
|
|||||||
def update(self):
|
def update(self):
|
||||||
for x in range(10):
|
for x in range(10):
|
||||||
for y in range(10):
|
for y in range(10):
|
||||||
self.screen.blit(IMAGES[self.env.field[y][x].number], (x * 80, y * 80))
|
self.screen.blit(IMAGES[self.env.field[y][x].number].img, (x * 80, y * 80))
|
||||||
self.screen.blit(self.agent.img, (self.agent.x * 80, self.agent.y * 80))
|
self.screen.blit(self.agent.img, (self.agent.x * 80, self.agent.y * 80))
|
||||||
pg.display.update()
|
pg.display.update()
|
||||||
|
12
src/main.py
12
src/main.py
@ -3,8 +3,8 @@ import pygame as pg
|
|||||||
from agent import Agent
|
from agent import Agent
|
||||||
from game_ui import GameUi
|
from game_ui import GameUi
|
||||||
from environment import Environment
|
from environment import Environment
|
||||||
from const import ICON, IMAGES_MAPPING
|
from const import ICON, IMAGES
|
||||||
from fieldsFactory import FieldsFactory
|
from tilesFactory import TilesFactory
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -17,7 +17,7 @@ def main():
|
|||||||
game_ui = GameUi(agent, env)
|
game_ui = GameUi(agent, env)
|
||||||
game_ui.update()
|
game_ui.update()
|
||||||
|
|
||||||
factory = FieldsFactory()
|
factory = TilesFactory()
|
||||||
|
|
||||||
running = True
|
running = True
|
||||||
|
|
||||||
@ -35,9 +35,9 @@ def main():
|
|||||||
elif (event.key == pg.K_w or event.key == pg.K_UP) and agent.y*80 > 0:
|
elif (event.key == pg.K_w or event.key == pg.K_UP) and agent.y*80 > 0:
|
||||||
game_ui.move('y', -1)
|
game_ui.move('y', -1)
|
||||||
elif event.key == pg.K_SPACE:
|
elif event.key == pg.K_SPACE:
|
||||||
if env.field[agent.y][agent.x].number > 3:
|
if env.field[agent.y][agent.x].mine:
|
||||||
env.field[agent.y][agent.x] = factory.create_field(
|
env.field[agent.y][agent.x] = factory.create_tile(
|
||||||
IMAGES_MAPPING[env.field[agent.y][agent.x].number]
|
IMAGES[env.field[agent.y][agent.x].number].parent
|
||||||
)
|
)
|
||||||
game_ui.update()
|
game_ui.update()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user