Added chests, they are immortal and contain objects the player can take for free.
This commit is contained in:
@ -10,7 +10,8 @@ from squirrelbattle.display.mapdisplay import MapDisplay
|
||||
from squirrelbattle.display.messagedisplay import MessageDisplay
|
||||
from squirrelbattle.display.statsdisplay import StatsDisplay
|
||||
from squirrelbattle.display.menudisplay import MainMenuDisplay, \
|
||||
PlayerInventoryDisplay, StoreInventoryDisplay, SettingsMenuDisplay
|
||||
PlayerInventoryDisplay, StoreInventoryDisplay, SettingsMenuDisplay, \
|
||||
ChestInventoryDisplay
|
||||
from squirrelbattle.display.logsdisplay import LogsDisplay
|
||||
from squirrelbattle.display.texturepack import TexturePack
|
||||
from typing import Any, List
|
||||
@ -29,6 +30,7 @@ class DisplayManager:
|
||||
self.logsdisplay = LogsDisplay(screen, pack)
|
||||
self.playerinventorydisplay = PlayerInventoryDisplay(screen, pack)
|
||||
self.storeinventorydisplay = StoreInventoryDisplay(screen, pack)
|
||||
self.chestinventorydisplay = ChestInventoryDisplay(screen, pack)
|
||||
self.mainmenudisplay = MainMenuDisplay(self.game.main_menu,
|
||||
screen, pack)
|
||||
self.settingsmenudisplay = SettingsMenuDisplay(screen, pack)
|
||||
@ -40,7 +42,8 @@ class DisplayManager:
|
||||
self.mainmenudisplay, self.settingsmenudisplay,
|
||||
self.logsdisplay, self.messagedisplay,
|
||||
self.playerinventorydisplay,
|
||||
self.storeinventorydisplay, self.creditsdisplay]
|
||||
self.storeinventorydisplay, self.creditsdisplay,
|
||||
self.chestinventorydisplay]
|
||||
self.update_game_components()
|
||||
|
||||
def handle_display_action(self, action: DisplayActions, *params) -> None:
|
||||
@ -87,7 +90,8 @@ class DisplayManager:
|
||||
|
||||
if self.game.state == GameMode.PLAY \
|
||||
or self.game.state == GameMode.INVENTORY \
|
||||
or self.game.state == GameMode.STORE:
|
||||
or self.game.state == GameMode.STORE\
|
||||
or self.game.state == GameMode.CHEST:
|
||||
# The map pad has already the good size
|
||||
self.mapdisplay.refresh(0, 0, self.rows * 4 // 5,
|
||||
self.mapdisplay.pack.tile_width
|
||||
@ -124,6 +128,19 @@ class DisplayManager:
|
||||
pack.tile_width * (2 * self.cols // (5 * pack.tile_width)))
|
||||
displays.append(self.storeinventorydisplay)
|
||||
displays.append(self.playerinventorydisplay)
|
||||
elif self.game.state == GameMode.CHEST:
|
||||
self.chestinventorydisplay.refresh(
|
||||
self.rows // 10,
|
||||
pack.tile_width * (self.cols // (2 * pack.tile_width)),
|
||||
8 * self.rows // 10,
|
||||
pack.tile_width * (2 * self.cols // (5 * pack.tile_width)))
|
||||
self.playerinventorydisplay.refresh(
|
||||
self.rows // 10,
|
||||
pack.tile_width * (self.cols // (10 * pack.tile_width)),
|
||||
8 * self.rows // 10,
|
||||
pack.tile_width * (2 * self.cols // (5 * pack.tile_width)))
|
||||
displays.append(self.chestinventorydisplay)
|
||||
displays.append(self.playerinventorydisplay)
|
||||
elif self.game.state == GameMode.MAINMENU:
|
||||
self.mainmenudisplay.refresh(0, 0, self.rows, self.cols)
|
||||
displays.append(self.mainmenudisplay)
|
||||
|
Reference in New Issue
Block a user