Needing some help with resource's for my shop

Godot Version

4.5.1

Question

I’m right now adding a shop to my game but I’m not really familiar with recource’s. I’ve used them before so I know how they kind of work but also kind of don’t, so just wondering if anyone has a idea how?

Your question is quite vague, so it’s hard to say anything concrete. You can check the docs for preliminary info on resources, though:

ok thanks!

Essentially you build a basic Item class that extends Resource

class_name Item extends Resource   
@export var item_name:String   
@export var item_cost:int 
# any other item code/properties

Once you have that saved you can click on add resource which in the latest version of Godot is tucked away under a 3 dot menu

In earlier versions it is right on that toolbar under Inspector (a scroll with a cyan +)

Then in the search bar you can type the class name Item and it should bring it up in the list.
Click on that and you will see your exports in the inspector.
Fill those out and select save as from the same menu as before and give it a name like “potion_of_healing”.
It will then save a resource file named potion_of_healing.tres which can be loaded and instantiated as needed.

thanks!

this helps alot

but also, do you know how to make the cost? like how do i make it select a currency?

I am not sure I understand that question.
If you want cost to be like $2.50.
You would change from int to float:
@export var item_cost:float
Then you would need a function to display the number 2.5 as a formatted currency.
You can google a number of ways to format and display that.
Here is a simple one.

thanks

Actually, using floating point for currency is widely considered a very bad idea. (Here is a an explanation for why this is so on Stack Overflow.) Unless you need to support ridiculously large numbers (like in most idle games), it is much better to use integers, but with cents instead of dollars as your base unit.