Manipulating with inventory
Lets begin with "On object clicked slot" event for mouse object:
Only action, that we can add for this even is the changing animation frame for "slot" sprite.
Now we need to detect if there is any object in this slot. To do this, we will use the two conditions:
In this condition we are checking if start slot is set and if this slot contain item.
If start slot is not yet set, we can set it. Along with this, we will set variables startitem and startnumber
Otherwise, if startslot has already been set, we need to set endslot:
Next, we have to set 2 conditions:
* if startitem ≠ enditem - we need to replace it and it's number
* if startitem = enditem - we need to summarize their number
What you get in the end:
Open full size image
Great, we finished the main part of our inventory system.
Now we need to automate all of our actions.