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):
|
||||
for x 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))
|
||||
pg.display.update()
|
||||
|
12
src/main.py
12
src/main.py
@ -3,8 +3,8 @@ import pygame as pg
|
||||
from agent import Agent
|
||||
from game_ui import GameUi
|
||||
from environment import Environment
|
||||
from const import ICON, IMAGES_MAPPING
|
||||
from fieldsFactory import FieldsFactory
|
||||
from const import ICON, IMAGES
|
||||
from tilesFactory import TilesFactory
|
||||
|
||||
|
||||
def main():
|
||||
@ -17,7 +17,7 @@ def main():
|
||||
game_ui = GameUi(agent, env)
|
||||
game_ui.update()
|
||||
|
||||
factory = FieldsFactory()
|
||||
factory = TilesFactory()
|
||||
|
||||
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:
|
||||
game_ui.move('y', -1)
|
||||
elif event.key == pg.K_SPACE:
|
||||
if env.field[agent.y][agent.x].number > 3:
|
||||
env.field[agent.y][agent.x] = factory.create_field(
|
||||
IMAGES_MAPPING[env.field[agent.y][agent.x].number]
|
||||
if env.field[agent.y][agent.x].mine:
|
||||
env.field[agent.y][agent.x] = factory.create_tile(
|
||||
IMAGES[env.field[agent.y][agent.x].number].parent
|
||||
)
|
||||
game_ui.update()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user