# Keeping count of current array value and moving...

Get help using Construct 2

### » Sun Apr 29, 2012 12:44 am

Hi! :)

Im currently making a board game (capx included), and I can't seem to figure out how to keep track of where my game-brick is, and using this value to move it. Lets say Brick is in the array at 0,0,1 , 0,0,0 (X and Y). How do I make this the current active slot i my array, and adding 1 to this concerning the brick moving to the right (Array (1,0,1 , 1,0,0).

I'm sure this is hard to understand, I'm not skilled at explaining it, but if someone has an idea, I would really appreciate it!

CAPX : https://www.dropbox.com/s/yndn600xsjazsrt/BoardGame.capx
B
9
S
1
G
3
Posts: 13
Reputation: 2,510

### » Sun Apr 29, 2012 2:17 am

CurX, CurY and CurZ works only when using a for loop, otherwise, they will always have the initial value which is zero. The simplest solution would be to use instance variables with the brick or global variables to store your current X and Y dimensions of the array.

Nice use of three dimensional array to store X and Y coordinates in the Z dimension .
B
28
S
9
G
6
Posts: 30
Reputation: 6,609

### » Sun Apr 29, 2012 3:07 am

you are so right... I'm thinking your tip will work, looking forward to trying it tomorrow :) Thank you, liked that one myself...
B
9
S
1
G
3
Posts: 13
Reputation: 2,510

### » Sun Apr 29, 2012 12:55 pm

Hi, I'm thinking you could give the brick two variables: path and step. So, the outer circle would be path 0, then the paths towards the centre would be path 1, path 2, etc. And the inner circle could another path. And the step variable would keep track of which square along the path you are. I'm not sure how the bricks move exactly but you get the idea.
http://dl.dropbox.com/u/8367729/construct/example/boardGameExample.capxramones2012-04-29 12:55:35
B
53
S
28
G
18
Posts: 1,520
Reputation: 24,905

### » Sun Apr 29, 2012 2:07 pm

Nice one! I did something similar, following Danijerry's tip, and I think I can complete it with your method :) Thanks guys!
B
9
S
1
G
3
Posts: 13
Reputation: 2,510