Skip to content

Shop (issue 42)#112

Merged
ultimateownsz merged 36 commits intomainfrom
shop-(Issue-42)
Mar 19, 2025
Merged

Shop (issue 42)#112
ultimateownsz merged 36 commits intomainfrom
shop-(Issue-42)

Conversation

@Davidek523
Copy link
Collaborator

Code Pull Request Template

Summary

This PR adds a basic functioning shop where the player can buy and sell items.

Related Issues

This PR Closes Issue #42 issue(s)


✅ Checklist:

  • 🛠️ I have tested my code, and it works as expected (e.g., game runs without errors).
  • 📝 I have made sure that the code follows the project's formatting and style guidelines.

Optional:

  • 💬 Code is commented (if applicable)

🏷️ Labels:

  • type: ...
  • area: ...
  • game: ...

Testing:
- inventory gui
Removed:
- two draw functions from the render method
Danilo said nothing
Removed a import
Added:
- a object layer for buildings
- for example: shop
Added:
- a custom property to the object
Added:
- shop file
Added:
- world layers to shop
- shop to game running
Added:
- drew the rect responsible for the shop
Added:
- collision for the shop
Added:
- a message when interacting with the shop
Added:
- if pressing E message is shown
Added:
- appearing black window when interacting with the shop
Fixed:
- window dissapearing after letting go of the E key
Removed:
- print statements for debugging
Added:
- base state and the methods to the shop class
Added:
- function for the buttons
Added:
- a method for handling mouse clicks
Finished:
- methods for the shop
Changed:
- spltied class in two because it was not working as expected
Fixed:
- some issues with the code and crashing
- shop window not showing when clicking E
Fixed:
- buttons not showing up
Changed:
- the amount visible items
Issues:
- fixed by ruff
Fixed:
- to show shop you have to press E twice
Fixed:
- if outside the shop and use E the shop would still open
Removed:
- old unused code
Changed:
- buttons from use and discard to buy and sell
Added:
- new messages to the json file for the shop
Added (to inventory.py):
- buy method
- sell method
Implemented:
- buy and sell into shop.py
Added:
- icons dict
- extract_icons method
Fixed:
- incorrect position of the quanitity sign
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.

I really like how you've handled the interaction between the shop and inventory for the buy/sell functionality. It looks well-structured and intuitive to use.

While testing, I noticed that the inventory's visual feedback isn't very clear when interacting with the shop. For example, when buying or selling items, it's not immediately obvious which items are already owned or in what quantities. I understand this might be outside the scope of your current work on the buy/sell functionality, but I wanted to highlight it as something we could consider enhancing in the future to improve it.

self.shop = src.shop.ShowShop(
(x * TILE_SIZE, y * TILE_SIZE), surface, self.all_sprites, WORLD_LAYERS["main"]
)
print(x, y)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You have to comment out this debug.

Removed:
- the debug print statement
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.

I approve these changes, we don't have to forget that in order to enter the shop state, you have to press the 'E' button which can be changed later on via an actual button or collide action like you already made.

@ultimateownsz ultimateownsz merged commit 7af0c8b into main Mar 19, 2025
1 check passed
@ultimateownsz ultimateownsz deleted the shop-(Issue-42) branch May 29, 2025 20:54
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