Can somebody please help me? Im Stuck.

Get help using Construct 2

Post » Thu May 11, 2017 10:14 pm

Well, Im working on some kind of inventory system, i got my slots, 1 to 8. Each slot holds place for 1 item ofc. And i ofc named them slot0, slot1, slot2...
And i build an array, which keeps track of the stored items. somethin like this:

If slot 0 overlaps with family.ItemIcons, set array x0y0 = 1

If slot 1 overlaps with family.ItemIcons, set array x1y1 = 1

If slot 2 overlaps with family.ItemIcons
----if slot x1y1 =1. set array x2y2 = 1

every tick - set "slot"...

and heres my trouble.
I want him to detect which slot is filled, and then put the number of the x or y from the array as the slot number how i named them. Is there an expression on that? something like:

set position to: "slot.global variable: itemcount"

Thanks! :D
B
14
S
1
Posts: 13
Reputation: 576

Post » Fri May 12, 2017 6:58 pm

ImageImageImageImage
B
30
S
9
G
7
Posts: 262
Reputation: 5,646

Post » Fri May 12, 2017 11:53 pm

darn, i dont have the newest version of Construct... :/
B
14
S
1
Posts: 13
Reputation: 576

Post » Fri May 12, 2017 11:55 pm

can you please describe howd you solve this problem?
That would be neat! :D
B
14
S
1
Posts: 13
Reputation: 576

Post » Sat May 13, 2017 7:11 am

ItsAstro wrote:darn, i dont have the newest version of Construct... :/


The newest stable release is HERE: https://www.scirra.com/construct2/releases/r244

There should be no reason for you not to upgrade to this version.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,541
Reputation: 60,426

Post » Sat May 13, 2017 7:37 am

zenox98 wrote:
ItsAstro wrote:darn, i dont have the newest version of Construct... :/


The newest stable release is HERE: https://www.scirra.com/construct2/releases/r244

There should be no reason for you not to upgrade to this version.

It's usually best to stay on one version of a program till you finish a project, even if the update is a stable release.

ItsAstro wrote:can you please describe howd you solve this problem?
That would be neat! :D

Yup, here you go:

So you'll need 3 objects (1 "Item" sprite, 1 "Slot" sprite and 1 "Inventory_Array" array)
Image

The "Item" sprite will have "Item_ID", "LastX" and "LastY" instance variables and the "Drag and Drop" behaviour:
Image

You'll need to add an animation frame for each object you want to store in the array:
Image

The "Slot" will only have the "Slot_Nr" instance variable:
Image

This is how the layout looks:
Image

An finally, this is the code (with comments):
Link: https://www.dropbox.com/s/vihkr5qsl3iq3r8/Code.png?dl=0 (Too big for a photo =D)


Let me know if you didn't understand something.
ImageImageImageImage
B
30
S
9
G
7
Posts: 262
Reputation: 5,646

Post » Sat May 27, 2017 1:59 am

Message: ItsAstro can only post plain text URLS until they have 500 rep. 3 URLS modified. Why?
TRMG wrote:
zenox98 wrote:
ItsAstro wrote:darn, i dont have the newest version of Construct... :/


The newest stable release is HERE: https://www.scirra.com/construct2/releases/r244

There should be no reason for you not to upgrade to this version.

It's usually best to stay on one version of a program till you finish a project, even if the update is a stable release.

ItsAstro wrote:can you please describe howd you solve this problem?
That would be neat! :D

Yup, here you go:

So you'll need 3 objects (1 "Item" sprite, 1 "Slot" sprite and 1 "Inventory_Array" array)
Image

The "Item" sprite will have "Item_ID", "LastX" and "LastY" instance variables and the "Drag and Drop" behaviour:
Image

You'll need to add an animation frame for each object you want to store in the array:
Image

The "Slot" will only have the "Slot_Nr" instance variable:
Image

This is how the layout looks:
Image

An finally, this is the code (with comments):
Link: https://www.dropbox.com/s/vihkr5qsl3iq3r8/Code.png?dl=0 (Too big for a photo =D)


Let me know if you didn't understand something.





Thanks for the Reply! :D

Well, i figured some invent system out, but your sounds better. :D
Heres the project, take a look, show me how youd do your stuff ;)
Anybody is invited to drop some knowledge. :3


https://www.dropbox.com/s/50aeq17wmq1ao ... .capx?dl=0

Cheers!
B
14
S
1
Posts: 13
Reputation: 576

Post » Sat May 27, 2017 6:36 am

ItsAstro wrote:Thanks for the Reply! :D

Well, i figured some invent system out, but your sounds better. :D
Heres the project, take a look, show me how youd do your stuff ;)
Anybody is invited to drop some knowledge. :3


https://www.dropbox.com/s/50aeq17wmq1ao ... .capx?dl=0

Cheers!

Seems like you can't post links yet...
You can change the url to something like "www [dot] dropbox [dot] com/etcetc" and then it'll work.
ImageImageImageImage
B
30
S
9
G
7
Posts: 262
Reputation: 5,646

Post » Sat May 27, 2017 1:26 pm

Message: ItsAstro can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Cheers![/quote]
Seems like you can't post links yet...
You can change the url to something like "www [dot] dropbox [dot] com/etcetc" and then it'll work.[/quote]


Strange, i knw that, and i changed the reply like 3 times.
I hope this will work now. And thanks for your help! :D

https://http://www (dot) dropbox.com/s/50aeq17wmq1aoao/Dungeon%20dweller (dot) capx?dl=0


Cheers! :)
B
14
S
1
Posts: 13
Reputation: 576


Return to How do I....?

Who is online

Users browsing this forum: Casaubon, max2612, Yahoo [Bot] and 5 guests