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

0 favourites
  • 3 posts
From the Asset Store
Cartoon Funny Item Interface Sound Pack comes with 426 high-quality sound effects
  • 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 :)

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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