Hello! I know someone out there has figured out a good functioning on-screen inventory system. Please post example links or potential code solutions.
Here is the link to my current game Dot Escape: http://www.flowlab.io/game/play/1067929
The desired effect:
- click on objects 1-10 and have them appear in the inventory (I got this far)
- have inventory follow you when you move from screen to screen when you click the arrows. (I brute forced this part after I gave up trying to have the items +/- positions like i did with the camera, but I feel like there is a much more elegant way to handle this)
- once an item is in the inventory (these are different items than the ones initially clicked on in the playing field), be able to click (mouse down) and drag (move mouse) the item back into the playing field and drop it into a valid location in the playing field.
- The item in use disappears from the inventory.
- item being used snaps to grid in playing field if released (mouse up) in a valid position. if released in an invalid position the item snaps back to inventory.
My problems are getting the inventory items to follow me from screen to screen (without brute forcing it) and picking up and moving the item from the inventory with the mouse. Mouse Click and Mouse Move are separate triggers, but I need a way for Mouse Click to trigger Mouse Move = position.
Additionally, in the case of “item 2” behind the pillow: is there a way to have the front object block the functionality of item block hidden behind it? As it stands, you can collect the Item 2 block without lifting the pillow first. I suppose I could have the Mouse Click --> pillow --> spawn the Item 2 block into position, but was wondering if there was another way.