How do I make an inventory without array

Get help using Construct 2

Post » Fri Mar 21, 2014 7:19 am

Message: kossglobal can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I was studying the manual and this tutorial (https://www.scirra.com/tutorials/583/ea ... ray/page-2) and I couldn't understand at all, specially the expressions and the theory behind the array.

Please, someone with a good patience could teach me?
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Fri Mar 21, 2014 8:56 am

https://www.scirra.com/tutorials/307/ar ... -beginners

https://www.scirra.com/tutorials/670/ze ... e-easy-way

I know this isnt the answer bud, but i found this array tutorial pretty awesome

also the inventory one is damn good hope it helps until someone can offer an alternative
B
10
S
2
G
2
Posts: 45
Reputation: 2,039

Post » Fri Mar 21, 2014 7:25 pm

Message: kossglobal can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Binkus wrote:https://www.scirra.com/tutorials/307/arrays-for-beginners

https://www.scirra.com/tutorials/670/ze ... e-easy-way

I know this isnt the answer bud, but i found this array tutorial pretty awesome

also the inventory one is damn good hope it helps until someone can offer an alternative


This is the tutorial which I mentioned :cry: . I just can't understand this sh**t. Thats why I asked someone to explain me in details. I'd like to know how to do it by myself, because It's a big and important feature in my game and I need to learn it, otherwise, I wont be able to solve any future bugs that may occur.

But Thanks. I'll keep trying to understand arrays.

However, I'd like to know if is there a way to do an inventory using just variables, since they can store information, which is what an inventory does, essentially.


Edit: I'm starting to get it a bit thanks to this tutorial for beginners. Thank you for sharing it.
Last edited by kossglobal on Sat Mar 22, 2014 12:15 am, edited 1 time in total.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Fri Mar 21, 2014 8:22 pm

Simple yet very effective Inventory System: https://www.scirra.com/forum/viewtopic.php?t=64557&start=0

A lot of solutions can be found in Kyatric's FAQ https://www.scirra.com/forum/viewtopic.php?t=63692&start=0.
B
22
S
9
G
3
Posts: 203
Reputation: 3,653

Post » Sat Mar 22, 2014 12:44 am

hey, I'm trying to do it but I have a problem

My array has 5 width,2 Height,1 depth

X = itens
Y= amounts.

So, If I have 5 apples, it's ID would be, for an example, in index(0,0) and it's amount in index(0,1).
The amounts will be right below of each item.

But how can I stop to adding apples to all slots, since it's 0 by default?
and how can I add +1 to amount everytime I "add" a new apple to that slot?

Image
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Sat Mar 22, 2014 5:39 am

Value=arr_inventoryshortcut.At(arr_inventoryshortcut.CurX,1)+1
ImageImageImage
B
71
S
22
G
247
Posts: 3,756
Reputation: 137,558

Post » Sat Mar 22, 2014 6:08 am

Image

I need to make it general to work with any objects (itens) and not only for this object that I chose. Someone knows how to do that?

Edit: Using families would work well for that? Because the game will have too many items with different characteristics like an sword or armor that can't be inserted more than one per slot, their different attributes, etc
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Sat Mar 22, 2014 9:36 am

If you need to make it work with several objects, yes families are perfect for that.

click on "item_family" > push to array
B
8
S
4
Posts: 131
Reputation: 1,205

Post » Sat Mar 22, 2014 8:37 pm

c13303 wrote:If you need to make it work with several objects, yes families are perfect for that.

click on "item_family" > push to array


But using families can I get every single instance variables working with arrays?

Edit: Nevermind, I got it. Thanks.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Sat Mar 22, 2014 11:18 pm

Alright, I'm facing another problem and I don't see how can I solve it.

After picking the itens....
I'm trying to put the objects in their repective slots. I tried to set it's animation to the same icon of the item but it seams a bad way to do it since I'll have too many itens in the game. The idea of having hundreds and hundreds of animations in each slot seams really bad.

Someone knows how to do it?
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Next

Return to How do I....?

Who is online

Users browsing this forum: koops and 7 guests