0 Favourites

simple inventory

  • Before i start, I know this subject has been discussed before and I have read through the topics I can find. but most are to complicated for what I need or not relevant to what I need.

    I want to build an inventory that works as follows:

    • player finds an item (lets say key)
    • player clicks on key
    • key is added to inventory
    • player comes to locked door
    • player clicks on door, if player has key door opens, key is destroyed

    I know how to do the above... next the bit I cant do:

    • player clicks inventory button
    • pictorial representetain of iventory is displayed
    • player clicks on item
    • item discription is shown (ie if player has a map, map is shown)
    • player moves from layout 1 to layout 2, inventory remains intacked.

    any help would be very helpful

  • I'm not exactly sure what you consider simple, but unless you're only going to have an inventory big enough for a couple items, you'll need to get comfortable using Arrays. There are some very helpful tutorials going over the basics of array in the tutorials sections of the site. I'd recommend you check them out.

    Here's an annotated demo. The inventory is stored in an array, so it will be saved between layouts.

    Demo

    Capx

    I hope this helps.

  • thanks for the response, that looks exactly what i am looking for, however your capx was made in the 121 beta, so i cant load it into my 119 stable, could you possibly save your 121 capx as a 119 for me please

  • I have been playing around with this and come up with a very simple way of doing this using the dictionary. I found that arrays were just too complicated, and overkill.

    Capx:

    dropbox.com/s/goul4up17byozb9/simpleinv.capx

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • thanks for sharing the inventor

    but i have problem when i change layout it reset the inventory

    oh player moves from layout 1 to layout 2, inventory remains intacked. i didnt see

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