Inventory with only ONE object

  • Hi All!

    I've been experimenting with Construct for a simple Adventure Game i'm planning and here's what i'm trying to do (it's a Platformer Style Layout but without any jumping):

    My Player Character should be able of carrying only ONE object at a time. It goes something like this:

    Character Picks up Key - Key goes in the Inventory and is destroyed in the Game World

    If a Character decides to pick up the pie, the key gets dropped back in the Game World at the point where the Character is standing, the pie gets destroyed in the Game World and appears in the Inventory.

    If however, the Character uses the Key on the Door, the Door opens and the Key gets destroyed permanently.

    Do you know of a good way to achieve this?

    My next step would be to give my character sprites multiple, separate Arms which are holding the different objects. So if your key would be in the Inventory you'd see the Character carrying it, same with the pie, etc. I thought about just doing the arms as separate sprites and then call them and let them follow the Players X and Y Coordinates.

    A very good example of the kind of thing i'm trying to do is this little Flash Game by Double Fine called Host Master Deux: Quest for Identity. You can play it for free on their Website, if you're interested. Thank you so much for your help!

    • Joel
  • "Character Picks up Key - Key goes in the Inventory and is destroyed in the Game World":

    If Inventory = 0

    MOVE it (x,y) to other place you call inventory. It can be outside the screen area or a interface.

    (now your inventory = 1)

    If inventory = 1, you cannot pick anything else.

    "If however, the Character uses the Key on the Door, the Door opens and the Key gets destroyed permanently." - Destroy the key

  • Hey Scofano

    Thanks for your reply. The problem is, i'd like the player to be able to pick up another object, even when he already has one in his Inventory but then they get switched out.

    So if the key is already in the inventory and i add the pie, the key returns to the game world and the pie wanders into the inventory.

    However, maybe i'm just making too big of a hassle out of it. Maybe i should try something with the pin function and make it like a Super Mario-picks-up-the-shell-and-carries-with-him function. I can't find any good tutorials on it unfortunately but maybe i'm looking wrong....

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Your Mario / pin guess can be a fine way.

  • See the comments in the capx.

    I don't really have time to comment right now, though it involves picking that you may find more about in the "How do I FAQ".

    Leave me a warning if you want me to explain further more (Write Kyatric in your post)

    I went directly for the "two arms" inventory as it is what you want in the end.

    For "simplicity" sake, I also went for two keyboard keys. X and C, each one taking/handling objects for each arms.

  • Thank you so much Kyatric! I'm going to look into it more thoroughly when i get back home from holiday but looks just like what i need! Now i just have to do some reverse engineering to figure out how it works exactly but i think thats a rather good learning exercise Thanks again!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)