Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions images/board_layout/CLI/board_template.txt

This file was deleted.

Binary file removed images/board_layout/CLI/layout_game_board.PNG
Binary file not shown.
18 changes: 0 additions & 18 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.


# import Pygame specific objects, functions and functionality
from src.game_manager import GameStateManager


if __name__ == "__main__":
# version choice is disabled for debugging reasons
game = GameStateManager()
game.run()

# print(
# """
# Welcome to Pyseas!
# Please select a version to play:
# 1. CLI version
# 2. GUI version"""
# )
# choice: str = input("Enter the number of your choice: ")
# while choice not in ['1', '2']:
# choice = input("Enter the number of your choice: ")

# if choice == "1":
# CLI().run()
# elif choice == "2":
# GUI().run()
521 changes: 0 additions & 521 deletions src/CLI/board.py

This file was deleted.

27 changes: 0 additions & 27 deletions src/CLI/buying.py

This file was deleted.

112 changes: 0 additions & 112 deletions src/CLI/gameloop.py

This file was deleted.

26 changes: 0 additions & 26 deletions src/CLI/inventory.py

This file was deleted.

37 changes: 0 additions & 37 deletions src/CLI/money.py

This file was deleted.

63 changes: 0 additions & 63 deletions src/CLI/player.py

This file was deleted.

19 changes: 0 additions & 19 deletions src/CLI/selling.py

This file was deleted.

7 changes: 3 additions & 4 deletions src/game_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
structure of the game, using a stack of states
"""


import sys
import pygame

Expand All @@ -24,8 +23,8 @@ class GameStateManager:
- Handling Pygame events and delegating them to the active state.
- Running the main game loop with controlled frame rate.
"""
def __init__(self) -> None:

def __init__(self) -> None:
# init pygame
pygame.init()
self.screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
Expand All @@ -44,9 +43,9 @@ def __str__(self) -> str:
return a string representing the stack
e.g. : >MainMenu>GameRunning>Paused
"""
stack_repr:str = ""
stack_repr: str = ""
for state in self.states_stack:
stack_repr += '>' + str(state)
stack_repr += ">" + str(state)
return stack_repr

def enter_state(self, state: BaseState) -> None:
Expand Down
10 changes: 7 additions & 3 deletions src/inventory_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, screen: pygame.Surface, inventory: Inventory) -> None:
self.item_height = 60

# Load sprite sheet and extract the icons (Testing purposes)
# To be replaced when:
# To be replaced when:
# 1) Spritesheet has been decide. 2) A 'Buy', 'Found' or 'Add' in-game feature has been implemented
self.sprite_sheet = pygame.image.load(
"images/tilesets/Treasure+.png"
Expand Down Expand Up @@ -92,7 +92,9 @@ def extract_icon(self, x, y, size=16):
"""Extract a single icon from the sprite sheet."""
return self.sprite_sheet.subsurface((x, y, size, size))

def draw_buttons(self, x: int, y: int, item: str) -> Tuple[pygame.Rect, pygame.Rect]:
def draw_buttons(
self, x: int, y: int, item: str
) -> Tuple[pygame.Rect, pygame.Rect]:
"""Draw Use and Discard buttons for a specific item."""
use_button = pygame.Rect(x, y, self.button_width, self.button_height)
discard_button = pygame.Rect(
Expand Down Expand Up @@ -181,7 +183,9 @@ def handle_mouse_click(self, mouse_pos) -> None:
"""Handle mouse clicks on buttons."""
for item, (use_button, discard_button) in self.button_actions.items():
if use_button.collidepoint(mouse_pos):
self.message = self.inventory.use_item(item) # `self.message` stores strings
self.message = self.inventory.use_item(
item
) # `self.message` stores strings
self.message_end_time = pygame.time.get_ticks() + 3000 # 3 seconds
elif discard_button.collidepoint(mouse_pos):
self.message = self.inventory.remove_item(item, 1)
Expand Down
Loading