Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
bcfd344
Edited the document file slightly because of some Pycharm errors, als…
ultimateownsz Mar 20, 2025
6928c3e
- Moved the sprites.py to a new directory called sprites
ultimateownsz Mar 20, 2025
31f935c
Removed redundant code, this is used in the game_running.py file in t…
ultimateownsz Mar 21, 2025
bc610b0
Fix type errors
ultimateownsz Mar 22, 2025
dee0c72
Remove old deprecated 'typing' import, since it is now standard in Py…
ultimateownsz Mar 23, 2025
6d6a859
Remove old deprecated 'typing' import, since it is now standard in Py…
ultimateownsz Mar 24, 2025
fc02979
Moved the shop.py code to a separate folder, states | sprites
ultimateownsz Mar 24, 2025
2364853
- Combined the Sprite & Entity classes
ultimateownsz Mar 24, 2025
fa381c4
- Fixed a typo in docstring.
ultimateownsz Mar 24, 2025
47347a7
Moved the AnimatedSprites class to its own file called animations.py
ultimateownsz Mar 24, 2025
6b7d67e
- Created a new abstract class for the CameraGroup, I wanted to chang…
ultimateownsz Mar 24, 2025
4feaed9
- Added some typehints to the codebase.
ultimateownsz Mar 24, 2025
e4cf5b3
- Player class inherits from BaseSprite now.
ultimateownsz Mar 24, 2025
2116731
- Tile class is moved to its own file and also inherits BaseSprite ab…
ultimateownsz Mar 24, 2025
945b947
Fixed ruff and mypy errors.
ultimateownsz Mar 24, 2025
5445cd2
Fixed an import issue for the PlayerCamera module.
ultimateownsz Mar 28, 2025
4f3568c
Add easier import to abstract base class for the pygame Group class.
ultimateownsz Mar 29, 2025
490d76c
Merge branch 'main' into refactor(sprites.py-file)
ultimateownsz Mar 30, 2025
58858a6
refactor(inventory_gui)
ultimateownsz Mar 30, 2025
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
23 changes: 14 additions & 9 deletions docs/Guides/InventoryGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ The `data/inventory.json` file controls the data for all items in the inventory.
2. Add, remove, or edit item entries using the following format:
```json
{
...
"Gold Coin": {"type": "currency", "effect": "collect", "quantity": 1},
...
"Gold Coin": {"type": "currency", "effect": "collect", "quantity": 1}
}
```

Expand All @@ -52,17 +50,24 @@ Each item in the inventory has the following properties:
### Adding a New Item Icon
To add a new item icon to the inventory:

1. Open `src/GUI/inventory_gui.py`.
2. Locate the initializer method (`self.icons: {}`).
3. Map the item name in `inventory.json` to the icon's location in the spritesheet. Use the following format:
1. Open `src/inventory_gui.py`.
2. Locate the initializer method (`self.icons: {}`).
3. Map the item name in `inventory.json` to the icon's location in the sprite sheet. Use the following format:

```py
class InventoryGUI:

```python
"Gold Coin": self.extract_icon(0, 0),
def __init__(self, ):

self.icons = { "Gold Coin": self.extract_icon(0, 0) }

def extract_icon(self, x, y, size=16):
...
```

[![icons-inventory-gui.png](https://i.postimg.cc/CMNKKL8T/icons-inventory-gui.png)](https://postimg.cc/231YcYT2)

4. Test the new item in-game to verify functionality and ensure no errors occur.
4. Test the new item in-game to verify functionality and ensure no errors occur.

## Known Issues

Expand Down
155 changes: 0 additions & 155 deletions src/GUI/gameloop.py

This file was deleted.

10 changes: 5 additions & 5 deletions src/game_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from src.settings import FPS, SCREEN_HEIGHT, SCREEN_WIDTH

# import basestate for typehint
# import base state for typehint
from src.states.base_state import BaseState
from src.states.game_running import GameRunning

Expand All @@ -29,14 +29,14 @@ def __init__(self) -> None:
# init pygame
pygame.init()
self.screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("PySeas")
pygame.display.set_caption("PyCeas")

self.clock = pygame.Clock()
self.running = True
self.events: list[pygame.event.Event] = []
self.states_stack: list[BaseState] = []

# instanciate the initial state
# instantiate the initial state
self.states_stack.append(GameRunning(self))

def __str__(self) -> str:
Expand Down Expand Up @@ -76,11 +76,11 @@ def run(self) -> None:
while self.running:
self._handle_events()

# give the pygame events to each states
# give the pygame events to each state
# to ensure that pygame.event.get() is only called once per frame
self.states_stack[-1].update(self.events)

self.states_stack[-1].render(self.screen)

# magic value, use a FPS const in settings or delta time
# magic value, use 'a' FPS const in settings or delta time
self.clock.tick(FPS)
2 changes: 1 addition & 1 deletion src/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def use_item(self, item_name: str) -> str:
if self.remove_item(item_name, 1) == get_message("inventory", "remove_success", item=item_name, quantity=1):
return get_message("inventory", "use_success", item=item_name)
return get_message("inventory", "use_fail", item=item_name)

def buy_item(self, item_name, quantity):
if item_name in self.items:
self.items[item_name] += quantity
Expand Down
Loading