Tutorial Downloads

File Size
algorithm.png384KB
Array based inventory.capx83KB

Translations

Know another language? Translate this tutorial!

Stats

2,275 visitors
47.8K page views
1,709 translation visitors
20.5K translation page views

Array-based inventory

Favourite 63 favourites
Tutorial written by WaltanOriginally published on 7th, July 2013 - 5 revisions

the finishing touches

Now create "Function" object. This will help us to control events easier.
Add one function "inv_open" for the algorithm, about which I wrote earlier.

When this function is called, we need to reset old data about our actions.


Now go back to the On object clicked "slot" event and do the same as in the screenshot:

And dont forget to call this function in the startup, to create first objects with which you will be working:

And that's all! You just created basic inventory "engine".
Try to play with it: make inventory bigger, add new items, add some visual effects (drag and drop or something) and so on.
If you liked my tutorial I will not deny myself in making additions to it :)

Also, you can check this inventory efficiency here.

Thank you for attention.

Unlock your full gamedev potential

Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!

View deals

Plus, it's got a lot of additional features that will help you save time and make more impressive games!

Congratulations on finishing this tutorial!

Did you learn a lot from it? Share it now with your friends!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.

Comments

2
Robin Sommer 8,131 rep

Hero! I'm gonna make one right now. :D

Sunday, July 07, 2013 at 11:01:37 AM
1
Waltan 7,885 rep
Hero! I'm gonna make one right now. :D
quoted from Robin Sommer

I hope you do not get confused in my bad English %)

Sunday, July 07, 2013 at 11:04:20 AM
1
Lordshiva1948 39.8k rep

Nice one I will start making mine soon

Sunday, July 07, 2013 at 12:06:58 PM
1
Waltan 7,885 rep

I just found a little bug in my algorithm with tx variable. (3rd page)
Check it if you got problems with it.

Sunday, July 07, 2013 at 1:39:38 PM
0
sosensible 9,626 rep

dont need it yet but this will defenetily come in handy

Sunday, July 07, 2013 at 3:22:23 PM
1
SergioRM 6,879 rep

This is really good.
Thank you!

Sunday, July 07, 2013 at 10:25:33 PM
1
AbelaNET 14.7k rep

Thanks for sharing

Monday, July 08, 2013 at 10:27:11 PM
1
Zebra 1,457 rep

Thanks you so much for this!! (and sorry for my englisch)
I followed your tutorial, but I don't know how to add another item in the inventory.
When I try to do your example of "inventory efficiency", new items replace the ones that are already in the inventory, I can't place them in the empty slots.

Friday, July 12, 2013 at 11:26:56 AM
2
Waltan 7,885 rep
Thanks you so much for this!! (and sorry for my englisch)
I followed your tutorial, but I don't know how to add another item in the inventory.
When I try to do your example of "inventory efficiency", new items replace the ones that are already in the inventory, I can't place them in the empty slots.
quoted from Zebra

Here you go. goo.gl/A16f8 Download this .capx of "inventory efficiency". I made comments for you. All you need is in "Control system" group.

Friday, July 12, 2013 at 12:32:35 PM
1
Joannesalfa 28.2k rep

This is really efficient, actually I'm wondering how to substract an item when it's used?

I would like to know if you improve this when an item is used, it should be destroyed when value is 0 or -1

Saturday, July 13, 2013 at 8:36:34 AM
2
Waltan 7,885 rep
This is really efficient, actually I'm wondering how to substract an item when it's used?

I would like to know if you improve this when an item is used, it should be destroyed when value is 0 or -1
quoted from Joannesalfa

As I said in tutorial (end of page 3) it checks if number of this item > 0.
So, for example, if you will subtract 1 every time when you right click on slot, when value in array at this slot will = 0, you also should to erase data about item ID.

Check this .capx: goo.gl/A16f8 ("Tutorial" group)

I also updated "inventory efficiency" example. You can now download .capx through it.

Saturday, July 13, 2013 at 12:28:14 PM
1
Altheon 1,041 rep

Hi Vladoss! your tutorial was great and this is the best inventory implementention we've seen here, but i would like to know how to expand with 5 equipment slots, its the missing piece that i cant wrap my head around on how to do on your inventory.
Can you help me?

Monday, October 14, 2013 at 12:44:22 AM
1
ffman22 5,557 rep

the reload button dont work?

Thursday, April 03, 2014 at 8:22:27 PM
1
Waltan 7,885 rep
Hi Vladoss! your tutorial was great and this is the best inventory implementention we've seen here, but i would like to know how to expand with 5 equipment slots, its the missing piece that i cant wrap my head around on how to do on your inventory.
Can you help me?
quoted from ffman22]
the reload button dont work?
[/quote]

Works for me.

[quote=Altheon

Can you tell me what you want in details?
Sorry for the long aswer.

Friday, April 18, 2014 at 5:49:28 PM
1
RookieDev 6,368 rep

Vladoss, If i wanted to use this method to make my Hotbar it would work fine.
What i dont understand is could i be able to move slots wherever i want?

I have a backpack that the player will keep all of his ingame items and it will not always be visible to the player and i would love to know if i can create slots where they are needed and if so how would i do that?
Or am i limited to how the array is drawn?

Tuesday, May 27, 2014 at 10:11:59 AM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.