How do I fix my Inventory Problem

Get help using Construct 2

Post » Fri Jan 09, 2015 4:44 am

You can the the difference between the two here; they need to match in order, at least with the current code.
You do not have the required permissions to view the files attached to this post.
B
11
S
4
Posts: 152
Reputation: 1,236

Post » Fri Jan 09, 2015 4:47 am

A better idea might be to use the same Sprite for both, and just have an instance variable 'isDisplay' to indicate it's an item displayed in the inventory.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Jan 09, 2015 4:51 am

"PS: You can reduce the "ToolStuff" code down to maybe 1 or 2 lines using an array or 2."

Any suggestions on how? I'm a complete noob for the most part
B
8
S
1
G
1
Posts: 96
Reputation: 632

Post » Fri Jan 09, 2015 4:56 am

Ok that fixed it btw. Changing the frame order. I'm such an idiot :/. Any idea on why the "aluminum" (Brownish thing) is not fitting in the slot right? That's another thing that's swamped me.

Edit: BTW thank you both with your help.
B
8
S
1
G
1
Posts: 96
Reputation: 632

Post » Fri Jan 09, 2015 5:04 am

To reduce the object handling code, Have an array (here called, ObjectsArray) that's full of item names, in the same order as the items are in the animation. Then, under Miningstuff, it would go ItemGroup = Mining --> Set ItemFrame to Objects.AnimationFrame and Set ItemName ObjectsArray.Objects.AnimationFrame

As for why the item isn't in the slot right; the crosshairs in the image editor lets you adjust where the object origin is. It should match up from item to item, but does not.
B
11
S
4
Posts: 152
Reputation: 1,236

Post » Fri Jan 09, 2015 5:11 am

Could you clarify the first part a bit more? I git confused somehow. Could also be because its late and I'm tired lolz, and thanks for the other bit. I didn't have the origins set right :/
B
8
S
1
G
1
Posts: 96
Reputation: 632

Post » Fri Jan 09, 2015 5:16 am

david7457 wrote:Could you clarify the first part a bit more? I git confused somehow. Could also be because its late and I'm tired lolz, and thanks for the other bit. I didn't have the origins set right :/


Best tip is to walk away from your project for a while (i.e. get some sleep) and look at it with fresh eyes. I usually spot a hard to find bug in a few minutes that way :D
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Jan 09, 2015 5:21 am

Start by making an array, Toolnames.
In System -> On Start of Layout
Toolnames -> Push Back "Hoe" on X axis
Toolnames -> Push Back "Shovel" on X axis
... "Hammer", etc,

You then have an array full of tool names.

Then in Toolstuff, you just need one Condition, instead of one for each tool:
Objects -> ItemGroup = "Tools"
But the action is,
Objects -> Set Itemframe to Objects.AnimationFrame
Objects -> Set Itemname to Toolnames.Objects.AnimationFrame


In both cases, Objects.AnimationFrame will be treated by Construct 2 as just a number.
So if the animationFrame was 2, it will set the ItemFrame to 2, and the Itemname to Toolnames object 2- which would be your hammer!
B
11
S
4
Posts: 152
Reputation: 1,236

Post » Fri Jan 09, 2015 1:08 pm

"Objects -> Set Itemname to Toolnames.Objects.AnimationFrame" this part is not working for some reason :/ Says "Objects is not a behavior in Toolnames"
B
8
S
1
G
1
Posts: 96
Reputation: 632

Post » Fri Jan 09, 2015 2:37 pm

Sorry, that should be Toolnames.At(Objects.AnimationFrame) I think
B
11
S
4
Posts: 152
Reputation: 1,236

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Colludium, varr, Yahoo [Bot] and 3 guests