How do I get my Inventory working?

0 favourites
  • 3 posts
From the Asset Store
Template for maintaining an inventory with crafting possibilities. Completely documented in text and video.
  • Hi Guys!

    So, i started working on my Sidescrolling Adventure Game and so far working with Construct 2 is great, even though i'm still pretty much a Beginner.

    The two hardest things for me will be the Inventory System and the Dialogue System. I started working on my Inventory today, looked at a Bunch of Tutorials and then decided to try it in my own way I'm using a Dictionary Object instead of an Array because i basically only need one Dimension of Data anyways and i kinda like the Dictionary.

    The picking up works like a Charm, it's the dropping of the Objects that gives me trouble... I honestly am totally confused at the moment so i try to explain what i did so far:

    SET UP

    I've got three Instances of my Inventory Slot with an Instance Variable from 1 to 3. The other Variable is called ActiveObject and determines, what object is currently displayed in the Slot.

    I also have two global Variables. One is called "OverlappingItem" and saves the Animation Name of the object on Screen (not in the Inventory). When my Player overlaps with the Object and presses Space, the Dictionary saves the current Variable as a new Key, or to make it more understandable, the name of the object.

    The "Selected Object" Variable, puts the name of the currently highlighted Inventory Item in a Variable, so the system knows, which Item is selected and gonna be dropped.

    As i said, i can add all the items in my Inventory without any problems, no matter in what order i pick them up, but i can't for the life of me figure out how to drop them from the inventory without it all going crazy. It seems to delete the key but i'm not sure how i update all the slots in the best way, so it knows where to put which key. It's kinda hard to explain but if you have any questions, let me know!

    Any help would be greatly appreciated! Thank you so much!

  • have a function to delete the object and recreate them or you can use array. Array is best used when data is being use as a position. I normally just use a dictionary to store data. but its the array that can position them with easy check out the scrollable inventory by katala in using a dictionary with his array.

    But yeah try doing the same thing with array you might have better luck there. The dictionary is horrible at positioning any thing. I had to rewrite my inventory because i couldnt get any positioning right. Just use the dictionary as a data holder to load into array for positional.

    because the array has a push pop and delete that does exactly what you want.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks!

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