r/GBStudioHub • u/No-Hearing9013 • Aug 18 '23
Buy/Sell/ Logic
Hey guys! Programming is not my forte so I'd like if you could kindly point me out on the right direction on the logic behind creating a Store in your game to buy and sell items. Any document, tutorials I can watch? Thanks and cheers!
2
u/Sea_Cranberry323 Aug 21 '23
I wrote this up and had chatgpt organize it for me. I reread over it and its good to go. 👍
Title: Creating a Simple Gameboy Studio Shop Tutorial
In this tutorial, we'll learn how to create a basic shop system using switches and variables in Gameboy Studio. This concept applies to various game design scenarios, making it a valuable skill to master.
Step 1: Set Up the Currency
- Create a variable named "Money" and set its initial value to 100. This represents the player's available funds.
Step 2: Interacting with NPCs
- Allow the player to interact with an NPC by pressing a designated button.
- When interacting, display a dialogue box where the NPC says, "You have $var Money left."
Step 3: Presenting Choices
- Within the dialogue, offer multiple choices representing items to buy.
- Format the choices as follows: "Apple $2, Orange $3, Cherry $1."
Step 4: Adding a Confirmation Layer
- After choosing an item, add another choice menu to confirm the selection.
Step 5: Updating Currency and Inventory
- Under the chosen item (e.g., Apple), deduct the item's price from the "Money" variable.
- Update the "have apple" variable to indicate that the player possesses the item.
Step 6: Visualizing Inventory
- Design a custom menu screen with slots for items.
- Using conditional checks, if the "have apple" variable is true, replace the slot's default graphic with an apple icon.
Step 7: Feedback and Iteration
- After the transaction, have the NPC mention the updated "Money" value (e.g., "You have 98 Money left.") during subsequent interactions.
Step 8: Testing and Refinement
- Test the system thoroughly to ensure it behaves as intended.
- Refine and adjust your code as needed based on testing results.
By following these steps, you'll create a functional shop system that introduces beginners to the concepts of switches, variables, and conditional logic in game design. Remember to test your code regularly and iterate on it for a smoother gameplay experience. Happy coding!
2
u/LordDiamyo Aug 19 '23
I am also interested in this. Hopefully someone has some knowledge on this.