[Plugin]Board, Layout2Board [Behavior] Grid Move

Post your completed addons to share with the community

Post » Sat Jul 30, 2016 7:53 am

@AndreasR

GridMove
Set property "MoveTo" to "No" to disable built-in moveTo behavior. Therefor, you could control the movement by yourself.

Board
Uses condition: is empty to test empty is correct. Transfer PXY to LXY using
- Board.PXY2LX( puzzle.X , puzzle.Y )
- Board.PXY2LY( puzzle.X , puzzle.Y )
Here is a sample capx which drag a chess between two boards.
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Sat Jul 30, 2016 8:28 am

rexrainbow wrote:@AndreasR

GridMove
Set property "MoveTo" to "No" to disable built-in moveTo behavior. Therefor, you could control the movement by yourself.

Board
Uses condition: is empty to test empty is correct. Transfer PXY to LXY using
- Board.PXY2LX( puzzle.X , puzzle.Y )
- Board.PXY2LY( puzzle.X , puzzle.Y )
Here is a sample capx which drag a chess between two boards.


Hi @rexrainbow

Thank you for your fast reply. It works perfect with an orthogonal board, but not with an isometric board. Because you need to calcualte an offset to the drop position, then if you drop the tile above the hole, the actual empty cell is a little bit further down (due to the isometric)

Hope it's understandable ;) At the moment it works (not perfectly, but it works). But I thought there is a smoother method than mine above.

Regards
Andy
Image Image
The Apple logo, iPhone, iPod touch, and iTunes are trademarks of Apple Inc., registered in the U.S. and other countries.
B
69
S
23
G
21
Posts: 905
Reputation: 20,760

Post » Sat Jul 30, 2016 9:10 am

@AndreasR

Here is a demo of dragging tile on an isometric board. ( source capx )
- drag tile from board to pull it
- drop tile to an empty cell to push it on board.


Is the hot spot of your tile/chess sprite not on the center?
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Sat Jul 30, 2016 10:01 am

rexrainbow wrote:@AndreasR

Here is a demo of dragging tile on an isometric board. ( source capx )
- drag tile from board to pull it
- drop tile to an empty cell to push it on board.


Is the hot spot of your tile/chess sprite not on the center?


Once again big thank you, @rexrainbow
I figured out that the problem is the "3D tile". It's not actually a square (64,64), that's why I needed an offset to detect the accurate LX,LY.
Now I made a workaround to snap to the empty cell when the tile hovers above it. That's why the origin point of the tile is not in the center.

Thank you!

Regards
Andy
Image Image
The Apple logo, iPhone, iPod touch, and iTunes are trademarks of Apple Inc., registered in the U.S. and other countries.
B
69
S
23
G
21
Posts: 905
Reputation: 20,760

Post » Sat Jul 30, 2016 10:28 am

@AndreasR

Yes, a position wrapping might be necessary in your case.
One possible solution is put a tile under the "drag-able" sprite (3D tile), and pin to the the "drag-able" sprite. Then you could still use the position of tile to detect the logic position ( LXY ).
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Sat Jul 30, 2016 3:54 pm

@AndreasR

I added the position alignment to the cell in the previous sample capx.
See the event 9:
Set position of tile to ( Board.PXY2NearestPX( tile.X , tile.Y ) , Board.PXY2NearestPY( tile.X , tile.Y ) )
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Sat Jul 30, 2016 7:10 pm

Thank you @rexrainbow I really appreciate your help. Just little suggestion. Is it possible to check "Board - For each cell of logic layer"?

I guess up to now the condition "for each cell" checks all logic layers. Am I right?
This would be a great feature to add another "for each cell" but where you can additionally specify the Logic Layer.


Regards
Andy
Image Image
The Apple logo, iPhone, iPod touch, and iTunes are trademarks of Apple Inc., registered in the U.S. and other countries.
B
69
S
23
G
21
Posts: 905
Reputation: 20,760

Post » Sun Jul 31, 2016 1:27 am

@AndreasR

"For each cell" will travel all logic X, Y of a board. For example, board size is 8x8, then "For each cell" will go through all these 8x8 cells.

Logic layer in my board is called "logic Z", it could be a number or a string. For example, logic Z =0 is a based layer for tiles. Usually I will put chess on logic Z =1. So I use logic Z 0, 1 in this case.
( "For each cell" will not check logic Z, it only check all logic X,Y )

I will add a "condition: For each LZ ( in a specific LXY )" later..
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Sun Jul 31, 2016 2:10 pm

Update

rex_board plugin: add "condition: for each LZ at LXY", "expression: CurLZ" to retrieve all LZ at a logic XY


@AndreasR
Here it is.
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Tue Aug 02, 2016 4:48 pm

rexrainbow wrote:Update

rex_board plugin: add "condition: for each LZ at LXY", "expression: CurLZ" to retrieve all LZ at a logic XY


@AndreasR
Here it is.


You're awesome! Thank you so much for your great plugin support :)
Image Image
The Apple logo, iPhone, iPod touch, and iTunes are trademarks of Apple Inc., registered in the U.S. and other countries.
B
69
S
23
G
21
Posts: 905
Reputation: 20,760

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: gamecorpstudio, MadSpy and 1 guest