Any way to add inventory/hotbar to game?

So I want the little guy in my game to be able to, when he breaks blocks, for them to go into an “inventory” of some sort, and he can choose what block he wants to place later on, then place it, as long as he has it in his inventory. Sort of like Minecraft. My game so far: http://flowlab.io/game/play/41690

Heres a short tutorial (placing is coming soon)

http://flowlab.io/game/play/41936

good game

um… have blocks at the top with number labels on them.
when you click on a block, you need a message to add a number to the block above with the number in it. Have it so there’s a filter if less than 1, there’s an off switch for placing that block.
Do something like 1 is grass 2 is dirt 3 is wood 4 is tree leaves or something
The mouse will place the block and such, then subtract a number from that block at the top. When less than 0, you can’t put that block.
I’m sure you’re confused, but in order to show you, I might as well build the whole game myself and put it on the gameslist. That would take a few days to make, and I just don’t have the time.
Luckily, Super Creator has become well accustomed to the anatomy of Flowlab, and he might understand what I mean.