Drag & Drop Inventory

Get help using Construct 2

Post » Mon Nov 04, 2013 12:26 am

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.
B
4
S
1
Posts: 4
Reputation: 388

Post » Mon Nov 04, 2013 3:10 am

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.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Mon Nov 04, 2013 5:57 pm

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.CloudShy2013-11-04 17:58:01
B
4
S
1
Posts: 4
Reputation: 388

Post » Mon Nov 04, 2013 10:34 pm

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.
B
4
S
1
Posts: 4
Reputation: 388

Post » Tue Nov 05, 2013 12:21 am

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...
B
18
S
6
G
3
Posts: 197
Reputation: 4,129


Return to How do I....?

Who is online

Users browsing this forum: Solomon and 11 guests