How to make an Item shop? (DotA/HoN/LoL/RoI like)

Get help using Construct 2

Post » Fri Jun 08, 2012 10:05 am

I want to make an item shop for my game with an inventory wich has 6 slots, the items are all in the Item family. Sounds simple but it isn't to me.

I opened my shop and when I double clicked an item ALL items were in inventory slot 1...

Can anyone help me with this? Best would be a working .capx :)
B
22
S
5
G
3
Posts: 13
Reputation: 4,910

Post » Fri Jun 08, 2012 4:36 pm

you need to pick a specific inventory slot not just hope itll pick an empty one

It doesnt matter how an inventory of any size is displayed to the players inventories are simply arrays

Dont think of your inventory in terms of this object is this slot and this item goes in this slot. Thats all just visual representation of the data in the array

if you have 6 inventory slots then you need an array of length 6. array position 0 = slot 1 ... array position 5 = slot 6

Store the info of the ITEM in the array position of the slot its in. To display that to the players create graphical objects to show thats contained in the array

Once your that far then you need to make sure you know which visual inventory slot object belongs to which spot in the inventory array. Id use an instance variable on the inventory slot object. Maybe even a family instance variable. With only 6 slots you could use globals too but I wouldnt advise it

Place 6 inventory slot objects in the game however you want. Assign each a number matching a slot in your inventory array (0-5) and THEN when you check for slots to use you can use the instance var to tell which slot it was that was clicked or whatever.

This will give you a working visual inventory but it WONT give you any management of it. Youll have to do that yourself once the rest is in place. Youll have to make sure the array position doesnt have anything in it before adding a new item to it. Youll have to control moving from one slot to another and/or switching positions with other objects.

But the basis for all that will be in place if you go with what Ive said here
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Fri Jun 08, 2012 6:04 pm

Thanks for your help, I already removed the Shop system from my game but will re-add it later then.

I also never worked with arrays.

and I still don't rly know how to make it place only the chosen item into the slot.RacerXXL2012-06-08 18:34:15
B
22
S
5
G
3
Posts: 13
Reputation: 4,910


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, plinkie and 20 guests