0 Favourites

Drag & Drop Inventory

  • Im working on a Top-Down-Shooter with Random Itemdrops.

    The Inventory has 9 Fields (1 Item in 1 Field and every Item can be placed in every field).

    The Items have Statusboosts like faster Movement oder more Shooting Damage.

    It works to place Items into the Inventory and the Statusboosts are working too. But i dont know how to check if the Item is moved outside the Inventory or to another Inventoryfield. Now i can place the Item once at every Field and get the Boost 9 Times.

    I made the Item with Animationframes(1 Frame is 1 Itemgraphic) and the Stats are Instance Variables.

    The Inventory is made out of one Sprite with an Instance Variable to specify wich Instance is wich Field.

    The Stats from the Items placed in a Field are Saved in an Array, one Dimension spezifies the Field the Item is placed in, the Other Dimension the Item Stats.

    Hope you can help me with this problem.

    Sorry, if you dont understand parts of it, my english is not the best.

  • You should be able to simply add a condition saying something like if item 1 is not active, then it can be activated. If item 1 is already active then it can not be activated again. This is what I did in my game. Do you have a capx of your specific situation? If so you might be able to get a more accurate response from someone more experienced then I am.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I dont upload the capx cause its private but i can explain the events i used for the Inventory.

    Item = the Sprite with the Droppable Items and Stats in it

    Slots = The Sprite for the Inventory slots(slot is the Instance Variable to specify wich Instance is wich Field in the Inventory)

    Inventory = Array for the Inventory(First Dimension for the Inventory Slot, The second for the Item stats)

    The Event looks like this:

    -------------------------------------------

    Item on Drop and Item is Overlapping slots

    -------------------------------------------

    Item set position to Slots (To place the Item at the Middle of the Field)

    Inventory set value at (Slots.slot,0)to Item.AnimationFrame (each frame is one Item)

    Inventory set value at (Slots.slot,1)to Item.Speed (Speed is the Instance Variable for the Speedboost, the other Item stat are in the following Fields like (Slots.slot,2) and so on...)

    ------------------------------------------------

    This is what i now have, but i dont know how to check if a Item is moved.

  • I try to make an easier explanation:

    I have a nine field big Inventory, i you put down an Item to a Field the stats are applied.

    But how can i check if the Item is moved out of the field where its placed before?

    Here you can try it:

    cloudshy.square7.ch/Games/show/index.html

    Movement with w,a,s,d. The Red rectangle is the Item, you can move it with your mouse at the Inventory, if you place it at a field at the inventory, a speed boost is applied, but if you move it out of the Inventory again, the boost is still there, and you can place the Item once at every field, so you can get the boost nine times.

  • how about putting the Itemnames in an array an check them? I think your capx would help alot, you could remove the stuff that is not relevant to this case...

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
1,069 148,751
han96's avatar
han96
Unread hot topic
604 153,313
aniketraorane's avatar
aniketraorane
Unread hot topic
257 37,755
han96's avatar
han96