How do I make the item system from Undertale?

0 favourites
  • 9 posts
From the Asset Store
Cartoon Funny Item Interface Sound Pack comes with 426 high-quality sound effects
  • Basically I want it so that once you press z while on the item button, 4 items will appear and if you press d or a, other items can appear as well like in Undertale, I don't know how to describe it any better but I have been contemplating if I should use the text object or the list object for this and how to execute it

  • I would use an array.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So how would I do it? I have never done arrays before and I don't know how to start it and code it

  • Start by adding an Array object to your project. Arrays are used to store multiple values in a single variable. They work like tables (rows and columns).

    In the properties set the Width and the Height. Example, if you only have one item, let's say an HP Potion, your array could be set to Width 1 (one row for one item) and Height 3 (three columns = name, hp, qty):

    Array object items [name][hp][qty] => ['HP Potion']['45']['2']

    If you have two items (HP Potion and MP Potion) the array could be set to Width 2 and Height 3:

    ['HP Potion']['45']['2']

    ['MP Potion']['25']['1']

    etc. etc. if you have more items.

    You can add as many rows and columns as you want depending on how many items you want to include in your game. Maybe use an array for your items and an array for your weapons if you have any.

    construct.net/en/make-games/manuals/construct-3/plugin-reference/array

    youtu.be/Us6aTgpreQ4

  • ok, I'll give it a shot and thank you

  • You're welcome. I hope it helps.

  • Actually I just thought about something, I know that arrays work for sprites with different animations, but what I am trying to do is that the items are text from one sprite, like this

    so I was wondering if the array would work and store multiple values in only one sprite (the text box) and how I can store values like health and if the item was used in some words like pie and what not, so does it work for texts like that and if so how can I code it?

  • I'm not sure if I understand the question right. Anyways, this is how I am display the items in my prototype at the moment (inventory menu).

    I'm using a loop to display the weapons/items and their stats.

    CurX: The current zero-based index for each dimension in a For each element loop.

    Arrays (Array expressions): construct.net/en/make-games/manuals/construct-3/plugin-reference/array

    Edit: I didn't make the sprites.

  • Update: I have done some arrays and I must say that they work well! the only thing I have to do now is apply all of it to the other items and figure out how to make it so that once an item is used, it will delete certain text like "pie" if pie is used, maybe I could make a separate text sprite for just items and not the menu, I don't know, but hey I have gotten one massive pain in the butt out of the way, so again thank you!

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