[Plugin]Board, Layout2Board [Behavior] Grid Move

Post your completed addons to share with the community

Post » Sat Jul 05, 2014 10:24 am

Hello! I return to bother you once more with questions!

I have a square on the board, a so-called "settlement", that I want to be able to use to create more units in the game. When asked to add another unit/chess I want it to place it either on the square itself, or next to it, if the square is already occupied. So far I am able to place the chess on the square, but when it is occupied I get the error when a space already has a chess in place - I can't make it go on to place it on the next tile instead.

Here is my code that I've experimented with so far, and which doesn't seem to work:

Image

Basically I want it to check if tile is empty? If so: place chess. If not: check if next tile in row is empty and place chess.
B
10
S
3
G
3
Posts: 110
Reputation: 2,206

Post » Sat Jul 05, 2014 4:15 pm

@Vati-nyan

What is "settlement.X, settlement.Y"? It looks like a physics position.
Most of board action/expression/condition are using logical X/Y/Z.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Sat Jul 05, 2014 7:08 pm

Those are the positions of the square that I either what the chess placed, or next to. It's like a base that produces these chess.
B
10
S
3
G
3
Posts: 110
Reputation: 2,206

Post » Sun Jul 06, 2014 12:08 am

@Vati-nyan

Ok~ but it is a physics position, i.e. position in pixels. Not a logical position, i.e, the index on the board. You might try to use logical position in board's ACE.
You could put chess behavior, then get logical position by chess.LX . chess.LY .
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Sun Jul 06, 2014 10:52 am

I think I understand what you mean, I need to use the X/Y numbers of the actual tile to put it on? Instead pf pixel positions.

I still don't entirely grasp how to do it in practice though, and how to make it move on to the next tile if the first one is occupied. Could you give a clearer example?
B
10
S
3
G
3
Posts: 110
Reputation: 2,206

Post » Mon Jul 07, 2014 3:10 am

@Vati-nyan

What's the logic of "picking the next tile"? Sorry, I did not get your problem.

My suggestion is, using "board condition:Is empty" to check the cell is empty or not. Change the logic XY to next cell until find an empty one.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Tue Jul 08, 2014 4:13 pm

I tested all your board plugins! That looks fantastic.

now i have to draw a Staggered Isometric map but square Tx plugin only support the normal diamond isomaps. Please is there an alternative or workaround for that.

Image

Thanks
B
8
S
1
Posts: 5
Reputation: 365

Post » Tue Jul 08, 2014 4:24 pm

@jiloogle

Well... I will try.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Wed Jul 09, 2014 6:14 am

Update

SquareTx plugin: support "Staggered" map. Select it at "Orientation" in properties table.


@jiloogle
Try it.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Thu Jul 10, 2014 3:22 pm

work like a charm thank you @rexrainbow

In the Attached repro.capx i got:
this.layout_mode is undefined in Rex_SLGSquareTx_plugin.js, line 225 (col undefined).
to fix it i changed that line from:
Code: Select all
      else if (this.layout_mode == 2)  // Staggered

to :
Code: Select all
      else   // Staggered
You do not have the required permissions to view the files attached to this post.
B
8
S
1
Posts: 5
Reputation: 365

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: matriax and 1 guest