How do I slot for inventory?

0 favourites
  • 7 posts
From the Asset Store
A slots game template designed to be skin-able for mobile
  • Hello, I need help adding items to my inventory. There are two items (green and red) each with a "Ammount" variable number that will be added to your inventory when you pick up an item from the ground.

    The problem for me is that when I pick up the same green items from the ground, each item gets added to the next slot. So more than 1 slot are occupied.

    I would like the green ones to gather in one slot and the red ones similar but in a different slot.

    This is my first question so far, maybe help will solve this problem.

    It's just that events recognize the fact that one of the slots already has the item.

    1 When in slots is no item and when we collect with the some ammount, one of the slots changes the animation frame, but...

    2 when the item is already in the inventory slot, the quantity is added to the existing one (does not create a new one)

    It's hard for me to get this effect because Construct "sees" that one slot is occupied but also sees that the slot next to it is empty and here is the problem

    my file:https://www.dropbox.com/s/p5e030m3cs5prn9/adding%20ammount%20to%20slot.c3p?dl=0

  • Your logic is the wrong way round, you first need to check if the slot exists which you are doing at the bottom. Then you can add an Else and run the logic that is currently at the top. I always promote the use of arrays for inventory though, it's much better and easier.

  • Your logic is the wrong way round, you first need to check if the slot exists which you are doing at the bottom. Then you can add an Else and run the logic that is currently at the top. I always promote the use of arrays for inventory though, it's much better and easier.

    Yes something in logic is broken. But always slots exist, always one slot is empty so even

    Arrays is dificult for me, i must try using simple sprites

    You mean i should add to events System condition 'Obiect UID exists'?

  • Your file won't open so I don't know how you broke that. I think all you need though is condition animation frame = item.ID add 1 to amount, Else add to empty slot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think all you need though is condition animation frame = item.ID add 1 to amount, Else add to empty slot.

    But how to add to empty slot?

    if i understand well:

  • No somehow that got worse. First condition - animation frame=item.id, add amount. (this means it already exists). second condition - Else, pick nearest to 0,0 where animation frame=0 and set the item id and add the amount.

  • No somehow that got worse. First condition - animation frame=item.id, add amount. (this means it already exists). second condition - Else, pick nearest to 0,0 where animation frame=0 and set the item id and add the amount.

    Ok, thanks for explonation, got it i will check this tommorow

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