E
Easien Games
Guest
I am currently working on a platformer where the player can also pick up items and craft tools.
The inventory system is already set up and working properly. The player should be able to craft tools by dragging two items into a 1x2 crafting grid.
Now I'm wondering, how can I save the crafting recipes so the game knows which combinations should lead to which results.
My only idea was creating a ds list like this:
The first two entries would contain the crafting materials, the third one the product and the fourth one the amount.
However for this method to work there must be an way to check if "item 1" and "item 2" are part of the same row of the ds list plus get the other two entries of that specific row.
If there is a way to make this work, please let me know! If not, maybe you could suggest another data structure I could use!
Thanks!!
The inventory system is already set up and working properly. The player should be able to craft tools by dragging two items into a 1x2 crafting grid.
Now I'm wondering, how can I save the crafting recipes so the game knows which combinations should lead to which results.
My only idea was creating a ds list like this:
Code:
ds_crafting = ds_grid_create(4, 1);
ds_crafting[#0, 0] = ITEM.LOG; ds_crafting[#1, 0] = ITEM.LOG; ds_crafting[#2, 0] = ITEM.WOODEN_PLANKS; ds_crafting[#3, 0] = 4;
However for this method to work there must be an way to check if "item 1" and "item 2" are part of the same row of the ds list plus get the other two entries of that specific row.
If there is a way to make this work, please let me know! If not, maybe you could suggest another data structure I could use!
Thanks!!