Deck numbers

Get help using Construct 2

Post » Wed Oct 16, 2013 8:52 pm

HI

I use a Deck to place sprites
4x4

But how can I create a nummer for each box
like

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

Maybe put them into a global variable

All Idears welcome :-)


B
33
S
17
G
11
Posts: 350
Reputation: 8,695

Post » Fri Oct 18, 2013 6:20 am

Okay...

How can I set a value each slot in deck that is 4x4
so I can track the position of the sprites

eg flower is in slot 6, bird is in slot 11 .....

Cheers

B
33
S
17
G
11
Posts: 350
Reputation: 8,695

Post » Fri Oct 18, 2013 10:18 am

If I understood you correctly, you'd want to save reference to a sprite in array? One way would be to save objects UID there, so you know which object is where.
B
24
S
9
G
7
Posts: 756
Reputation: 7,302

Post » Sat Oct 19, 2013 5:44 pm

Ooohhh yes your right !!

BUT how can this be done ..lets say that I push a sprie and want to know
where its placed

thanks for relpy
B
33
S
17
G
11
Posts: 350
Reputation: 8,695

Post » Sat Oct 19, 2013 6:16 pm

Use an array.

Parse it via a function where you set the first parameter to the sprite you are looking for.

function
-For each X
X = function.param(0): set localvariable to array.CurX
function set returnvalue to localvariable

after that access the position of the searched element via function.returnvalue

if you have/expect duplicates, use an array again or save the numbers as string with separators and later on parse it out
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786


Return to How do I....?

Who is online

Users browsing this forum: blue visionary and 24 guests