How do I fix my inventory placing items problem?

Get help using Construct 2

Post » Mon Oct 19, 2015 4:46 pm


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?

Posts: 2
Reputation: 179

Post » Mon Oct 19, 2015 8:38 pm

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.
Posts: 2
Reputation: 179

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 62 guests