|Topic was automatically imported from the old Question2Answer platform.
This has probably been asked and answered many times. I’ve done research into the matter but still cannot wrap my head around how I’d do it.
I’m trying to figure out a proper way to store items. I can simply handle this as a JSON file, right? The problem is, what if there are consumable items? How do I make these items have effects? I’ve decided storing every item as scenes and scripts so that they can be used, but this prevents the full use of a json file then does it not?
I’m completely lost, so what would be an appropriate way of handling this?
For the record, I know how I’d store them as classes. The point is, in godot, you cannot just instantiate a class like you could in normal C#. So this leaves me confused. Do I just create 1000 item scenes with different scripts associated with them? I’ve heard having tons of scenes like this could be bad.
What do you mean by items exactly, what kind of scene are we talking about? Is it a sprite with some variables and multiple animations?
I’m trying to undertstand what needs to be stored for each item (used or not), and what is common to all of them.
IvanVoirol | 2020-08-31 14:37
EDIT: Wrote a comment before but I was tired and didn’t give a proper description.
So generally think of most JRPGs. When you have a Health Potion, for example, what might be needed for one of these? A name, an icon, a use, maybe a description. The list goes on for what might be needed.
Would it be wise to create a scene for every single item with their own scripts and use cases so they can be instantiated when needed? Or would it be wise to just have one “item” scene, then add a script to it whenever needed?
It seems redundant to create a JSON file for storing item information when you need a script for each item anyway. Why not have the item stats in each script that will be “used” anyway?
Just a thought.
scarletred012 | 2020-08-31 17:02