# [Plugin]Board, Layout2Board [Behavior] Grid Move

### » Sun Jan 27, 2013 1:42 pm

Is there anyway to set a value at points (0,0) like at arrays. I tried it with board instance or with hex tx instance.
For x 0 to 9
y 0 to 9

then on button click It gives only sum (100)
------------------------------------
With hex tx, I created a chess object. Then I tried to move it with grid move(hexagon) Up arrow is down, right arrow pressed It moves two squares right one square up, if two squares are available.

https://dl.dropbox.com/u/56268958/hextx-test.capx

It would be really great if somene could share hex tx example.

Thank youSpider_hip2013-01-27 14:43:06
B
7
S
1
G
1
Posts: 76
Reputation: 904

### » Sun Jan 27, 2013 5:03 pm

@Spider_hip

It looks like that you want to move twice since "Up arrow is down, right arrow pressed" will trigger both of
"+ right arrow pressed" and ""+Up arrow is down, right arrow pressed". So that it move "Up-right" and "Right" at the same tick.

To pick chess at logic (0,0) , you might use "condition: pick chess at logic XYZ". Then do something after picking.
B
96
S
22
G
157
Posts: 4,030
Reputation: 93,320

### » Sun Jan 27, 2013 6:05 pm

My bad about movement. Thank you. I added inverted up-down arrows to solve that, and works like a charm now.

Well actually I wanted to ask to set value to points, like "set value at" (arrays)

Beceause I made something like this with arrays.

https://dl.dropbox.com/u/56268958/neigbor-algorithm.capx

And I pretty liked the result.

First I randomly set values to all array points. Then for each xy, I look for neighbor values. %50 chanse to convert current point to neighbors sum.

There are 4 green, 2 blue and 2 red neighbors. So mid square has a %50 chanse to convert to green. So it becomes like , continents at the end(with a 2-3 repeats).

It's like this logic

http://www.emanueleferonato.com/2011/05/13/flash-procedural-map-generation-example-land-and-water/

It divides squares. And gives chanse for child squares to look like mother square. But mine looks for neighbors. And looks like to them.

I wanted to do smth like this with your beatiful board plugin.

Sorry for my bad english.Spider_hip2013-01-27 18:12:29
B
7
S
1
G
1
Posts: 76
Reputation: 904

### » Mon Jan 28, 2013 4:04 pm

@Spider_hip

The "array" is stored at each chess (cell) on the board. In this case, you might save the value at private value of each chess (cell).
Just pick chess (cell) by condition/action: pick chess at LXYZ, then read the private value. (or you could present the value at frame index)rexrainbow2013-01-28 16:06:31
B
96
S
22
G
157
Posts: 4,030
Reputation: 93,320

### » Mon Feb 11, 2013 11:40 pm

Update:

- Now grid move behavior could move tile (z=0) since some users might ask me why grid move could not work. It might be easy to use in a small case which only have tiles on the board.rexrainbow2013-02-11 23:41:27
B
96
S
22
G
157
Posts: 4,030
Reputation: 93,320

### » Wed Feb 13, 2013 2:07 am

Hi All,

I have a few questions regarding the awesome plugins created here.
I'm working on extending the moving options demo. This is the one where you click a black chess piece then it shows you where you can move it etc.

Is it possible to make the layer bigger, when using the board object plug in I can't get a 13x20 board to fit on the layer :-(

I'm wondering is if I'm approaching this correctly.
I want to have say 4 pieces for each player, so player one puts down 4 pieces (clicks on four empty squares) and then player two does the same.

Should I set instance variables on the chess piece to mark it as being P1 or P2 etc. Then then anotehr Instance Variable for setting the piece type?

Thanks for all your help the first problem is the one I'm struggling with the most.

Thanks
Chrisstobbsc2013-02-13 02:22:51
B
3
Posts: 7
Reputation: 439

### » Fri Feb 15, 2013 2:33 am

Finished reading the whole thread and it looks like some amazing stuff going on.

2 questions.

What is the easiest way to switch between movable chess tiles?
At the moment I've saving the x,y to global variables then when moving I'm using the board to pick them and then moving

Second questions is I've used the movement object to define the movable path then I move the piece but when I use inst->clean it doesn't remove my path tiles?

Thanks
Chris
B
3
Posts: 7
Reputation: 439

### » Fri Feb 15, 2013 2:38 am

@stobbsc

Uh, I'm not sure what's you mean "make the layer bigger".
If you want to make a bigger board, just set the width and height at properties table of board object, or use "action:Set board width", "action:Set board height".

About question 2, it depends on your design, these plugins did not handle the owner of chess.rexrainbow2013-02-15 02:39:31
B
96
S
22
G
157
Posts: 4,030
Reputation: 93,320

### » Fri Feb 15, 2013 2:48 am

Thanks Rex,

I've managed to just add instance variables so I know what type of piece I'm working with and what player they belong to :-)
B
3
Posts: 7
Reputation: 439

### » Fri Feb 15, 2013 3:03 am

@stobbsc

To swap two chess, you could save one UID of chess, pick the other one, then use "action:Swap" in grid move behavior and put the first UID of chess in parameter. It will swap the logic index and physical position.
If you want to move the chess by your self, you could use "action:Swap chess by UID" in board object, it only swap the logic index.

About question 2, I'm not sure what's you means the "inst->clean". Uh... I did not remember I had made this action.
The moving path is stored by UID of tiles. User just pick tile by these UID and do what they want.rexrainbow2013-02-15 03:04:08
B
96
S
22
G
157
Posts: 4,030
Reputation: 93,320

PreviousNext