So, I have a inventory array set up for my game that would add 1 to your block counter in your inventory every block you break, only problem is I don’t understand how to do this for I don’t use arrays very often.
To solve this problem, I made a new function called ‘CollectItem’ that is called every time the player should collect an item. It takes the name of the item as an input.
The function simply checks if any of the items in the inventory have the same name as the item we’re collecting, and if it does, it adds 1 to the tooltip value.
And on a side note, this game is REALLY REALLY COOL!! I ADORE how much detail you’ve put already into the gameplay and art, it’s clear there’s a ton of content here. As a bonus, you organized this code really well, so it was quite easy to understand your code and work out a solution.
Please update me if you ever release this game!

Thank you! It is a MakeCode Arcade Recreation of a game me and a friend are actively about to release a demo of this Halloween! This is just a passion project to pass some time and get some ideas.
this is from a separate forum thread and I’m not sure how to integrate it into the separate system. I have blocks that the number goes down on when placed and goes up on when collected, apples, coins, and spells that will go down and blocks you can craft into other blocks, I’m confused how to do this
like in the hotter if you press the a button you will craft planks from logs that’ll need to take from your log count and add to your plank count no matter where in the inventory, not sure how to do that so while I wait I will fix the doors and springs to have more use. it’d help if I could get assistance figuring out the way to do the inventory.
I’m not exactly sure what you mean, but here’s my attempt:
I made a simple function to craft an item by losing a number of materials and collecting the result.
(For example, for the crafting recipe you said, you would input “Log”, 4, and “Planks”)
The only thing left then to craft an item is to have the player signal they want to craft. If you can give me more details on how a player would start crafting, I can try to implement that, too!
Here’s the quick fix: https://makecode.com/_6sfbMa8kVaq1
im thinking about when i press a it autocrafts and deposits it into your hotbar/inventory,
like you have a log in your hotbar, you press (a) and then you get 3-4 planks back whereever it is stored in your inventory, then with food items you would press a to use them and it would count down accordingly
That could work, but currently pressing A in the hotbar makes you deposit an item back into the inventory.
If pressing A on wood in the hotbar would craft it into planks, there would be no way to deposit wood into the inventory without crafting it first!
Plus, the crafting recipes would be limited to only having one ingredient each.
that’s ideally how I want it maybe, its kind of a mess but I want to implement crafting so the resources aren’t so limited later on
The primary thing is a system to allow a player to convert blocks to different blocks, I could use another key bind since I have the key bind extension. also when you switch the item from the inventory to hot bar it sets the number to 0 and no longer counts correctly. How would I fix that and lastly how would I work the locking placing blocks behind if you actually have the block like in mc?
To fix the hotbar to inventory switching issue, I added a condition that you can’t move an item from the inventory to the hotbar if it’s value is 0.
And to fix the error that happens when you try to pick up an item but your existing items are in your hotbar, I made the ‘collect item’ function also check your hotbar if it can’t find the item in your inventory. You also have to force the game to redraw the hotbar if you collect an item to the hotbar, because otherwise it won’t update.
For the other two issues, the first is a game design issue (It’s up to you to decide what mechanism the player should use to craft!) and I’m not sure I understand what locking placing blocks means.
Here’s the fix, hope this helps!
it helped, now I want to figure out how to prevent the lag that is generated from the game in general and stop the player from crafting without setting your resources into the negative.
First, to help with lag and help with limiting crafting conditions, we can take this repeated section of code and make it into it’s own function:
This way, we can simplify the ‘Collect item’ and ‘Lose item’ functions into this:
So we can easily modify the craft function to check for the number of materials:
Here’s the link to add this function!
The lag issue is a harder one to fix, but there are helpful tips in this thread!