Skip to content

Loot islands (issue 115)#119

Closed
Davidek523 wants to merge 33 commits intomainfrom
Loot-islands-(issue-115)
Closed

Loot islands (issue 115)#119
Davidek523 wants to merge 33 commits intomainfrom
Loot-islands-(issue-115)

Conversation

@Davidek523
Copy link
Collaborator

Pull Request Template

Type of Pull Request

Only check one box per pull request.

  • 🛠️ Code - Changes to the codebase.
  • 🔄 Revert - Reverts a previously merged commit or PR.
  • 📄 Documentation - Updates to documentation files.
  • 🎵 Audio - Changes to audio files.
  • 🎨 Asset - Updates to design or visual assets.

Summary

This PR adds chests and voyages to the islands. Now every island will have either a chest or a voyage. The player can collect the chest only one time, after collecting a chest it will be added to the inventory and the player can no longer collect the chest from said island again. He can go to other islands.

Related Issues

This PR closes issue(s) #115


✅ Checklist:

  • Tested the changes locally.
  • Verified that no breaking changes are introduced.
  • Updated documentation (if applicable).

🏷️ Labels:

type: ..., area: ..., game-..., ...

Added:
- collision boarders to each island
Added:
- collision boarder into setup in game running
Added:
- a copy of the map that is today
Added:
- working collision between the player and the islands
Added:
- when comming in contact with the island the player recieves  chest
Added:
- new state file for chests
Tested:
- the collision and adding in game running
Added:
- update and render method to the chest state
Added:
- system to pick up the chest with a press of a key
- message to show when the player collects the chesrt
Enhanced:
- the player comes in interaction with the island
- now when the player interacts with the island hell get the message
Updated:
- the screen position
- the size of the screen
Extracting chest icons for the messages
Fixed:
- wrong icons getting extracted
Scaled:
- the chest image from 16px to 64px.
Added:
- chests are now randomized
Added:
- a voyage scroll icon to the loot dict, now there is also a chance to receive a voyage
Changed:
- The test chest name to the actual chest name
Changed:
- the loot names to look more appealing in game
Added:
- new chests to the json invnetory
Small additions
Added:
- when claiming a chest from one island you cannot claim it again
Added:
- if collecting a chest/voyage the player cant collect it the second time again
Removed:
- debug code for checking islands within island code
- Removed commented code
Added:
- prompt for pressing the key to interact
Added:
- prompt for using inventory
Finally some good fucking food
Small fix interaction buttons message
Fixing issues
Copy link
Collaborator

@ultimateownsz ultimateownsz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is a good start, but it is creating visual inconsistencies. Cool feature when I go to different islands, that it adds each time a new item to the inventory. Haven't tested if the item can be a duplicate because our inventory starts full. Perhaps for the test cases, clean the inventory so you can properly test edge cases.

What I do find something that isn't clear, why the player has to press the button e when being in collision with an island, having to press e again to receive an item. For testing purposes it's fine but, for the game's feel, it adds too many steps in my opinion.

I also noticed some things going wrong:

  • When sailing towards the shop, pressing e to interact, this is shown:
    image

  • After pressing q the shop window appears:
    image

  • After pressing the q button again, the shop window is gone as before.

  • When the player's position goes to the edge of the left sea, where the screen ends, the message is gone too:
    image

  • When the player starts at the initial starting position, it isn't very clear that if you hit the island, that you can interact with it, since the message of Press E to interact is showing constantly, it also creates a visual bug:
    image

  • When hitting an island you see that you can pick up the chest, when I press E to interact, I receive the message that a voyage has been added to my inventory but what I saw was clearly no chest:
    image

  • After receiving a scroll, I see a misspelling in the inventory shown, and the visual item representing in the inventory is gone too:
    image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for changing the map name to version, it should reflect what you changed in the map, don't you think?

self.facing_direction: str = "down"

# Chest bool
self.chest_collected = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be wise to store this boolean in the class you inherit the chest in? Like for example the player, since this is an abstract class, and if we would add other entities than a player it would not make much sense to store the chest bool value.

@@ -0,0 +1,111 @@
import random
from typing import List, Optional
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use Python 3.12, you can update the type hints to use the more modern syntax, by removing this line and updating the following lines: 28, 54

self.inventory: Inventory = inventory

# collide can be None or a Sprite
self.collide: Optional[pygame.sprite.Sprite] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.collide: pygame.sprite.Sprite | None = None

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def update(self, events: list[pygame.event.Event]) -> None:

# Draw the green dot at the screen coordinates
pygame.draw.circle(screen, (0, 255, 0), (dot_x, dot_y), 5) # Green circle at tile coordinates

self.message = self.font.render(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your message appears constantly, and if the player goes out of the position of the camera, it doesn't dynamically follow the player's camera.

@Davidek523 Davidek523 closed this Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments