0 Favourites

How do I fix my inventory placing items problem?

  • Hello,

    I have this specific problem with inventory in my game.

    1. So i have this inventory panel (sprite) with collected items on it (sprites)

    This inventory panel is created when i mouseover certain area and stays on screen while mouse cursor is over it.

    2. When i click on item, default mouse cursor changes to item appearance and that item is destroyed.

    3. Now i hold the item and mouseover and click interactions with other items and areas are working fine.

    4. Now i want to make item drop to inventory when i click on inventory only. Item should be created and cursor should take default game appearance.

    5. If i try to create item on mouse.x mouse.y it wont create over inventory or anywhere on the screen at all.

    6. If i try to create object on predefined x,y position on the inventory it does work, but does not work at the spot where i picked the item from (destroyed it or moved it when i picked it up). I cannot take item, then immediately put it back on the same spot. I need to move mouse to another spot on the inventory and only then it will create at that predefined spot.

    I tried following and every possible combination of it:

    • putting everything on different layers
    • on object (inventory) clicked - create item
    • mouseover (inventory) + left click - create item
    • Moving items and inventory panel instead of creating and destroying

    nothing seems to help.

    is there some limitation or i am doing something wrong?

    thanks

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • fixed it...

    basically, when i clicked to place the item the engine would instantly pick that item up again with the same click.

    if i swapped the picking and dropping code order then picking item would instantly drop the item again so it would seem like it was not picked at all.

    so i made a global variable that tracks the state of the item and make sure only respective code for each state is executed in one cycle.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
175 32,636
clifton11221's avatar
clifton11221
Unread hot topic
99 10,137
karshinkoff's avatar
karshinkoff
Unread hot topic
98 7,594
norum82's avatar
norum82