[BEHAVIOR] Isometric

Post your completed addons to share with the community

Post » Tue Sep 22, 2015 9:03 pm

@delgado
The behavior only does sorting when the game is run. For it to sort correctly the isometric size and z of the blocks need to be set correctly. If the blocks overlap in isometric space the sorting won't work right.
B
94
S
33
G
117
Posts: 5,389
Reputation: 75,339

Post » Wed Sep 23, 2015 8:00 am

I'm having an amazing fun with your plugin


One thing I can't figure out is how to implement pathfinding with it.
Even if only for the X and Y axes, how would you do it?
B
10
S
4
G
1
Posts: 31
Reputation: 1,409

Post » Wed Sep 23, 2015 5:00 pm

@balsh
The easiest solution is to have a layer with a top view of the iso blocks and pathfind around that.
https://dl.dropboxusercontent.com/u/542 ... nding.capx

It's just a matter of setting the position from the isometric position or vice versa.
B
94
S
33
G
117
Posts: 5,389
Reputation: 75,339

Post » Wed Sep 23, 2015 6:18 pm

Great addition. cheers!
B
21
S
5
G
8
Posts: 1,215
Reputation: 7,834

Post » Thu Sep 24, 2015 12:21 pm

@R0J0hound
thanks that's what I was expecting from what I've read in other threads but I was having trouble cause I was not using contenairs.
B
10
S
4
G
1
Posts: 31
Reputation: 1,409

Post » Fri Sep 25, 2015 3:11 am

that behavior is unbelievably good! nice work hound
B
13
S
3
G
1
Posts: 51
Reputation: 971

Post » Fri Sep 25, 2015 3:09 pm

Rojo can you add t behavior condition. if object is moving do something?
B
113
S
28
G
48
Posts: 1,882
Reputation: 36,478

Post » Fri Sep 25, 2015 6:45 pm

@delgado
An "is moving" condition would only make sense if the behavior was automatically moving the objects. As it is now you control when it moves so you can either do stuff there or set a Boolean to do stuff later.
B
94
S
33
G
117
Posts: 5,389
Reputation: 75,339

Post » Fri Sep 25, 2015 10:06 pm

MINI TUTORIAL #1:
When using this behavior it's required to setup the isometric size of the sprite. Here's a quick guide how for to do it for two kinds of shapes.

The first thing to setup before anything else is to put the sprite's origin to the center.
Next, just for reference here's the isometric coordinate system:
Code: Select all
        +z
        *
        *
        *
        *
        **
      **  **
    **      **
  **          **
+y              +x

The iso size x is along the x-axis, the y on the y-axis, and so on.

The first kind of shape is this:
Code: Select all
      **
    **  **
  **      **
**          **
* **      ** *
*   **  **   *
*     **     *
*     *      *
**    *     **
  **  *   **
    *** **
      **

Basically any shape where the sizeX is the same as the sizeY. Here's how to calculate the sizes:

sizeX = sprite.width/2
sizeY = sprite.width/2
sizeZ = sprite.height - (sizeX+sizeY)/2

The second shape is this:
Code: Select all
**
* **
*   **
*     **
*       **
*        *
*        *
*        *
**       *
  **     *
    **   *
      ** *
        **

Basically a shape that's flat on the x or y axis.
The size of the above can be calculated with:

sizeX = sprite.width
sizeY = 0
sizeZ = sprite.height - (sizeX+sizeY)/2

You can handle a shape that's flat in the x direction instead by swapping the sizeX and sizeY values.

Often you'll want to make the actual sizes a bit smaller to keep the objects from overlapping in isometric. This is especially important if positioning on a grid since you don't want the sizes to be bigger than a grid size or it won't sort right.

Here's an example:
https://dl.dropboxusercontent.com/u/542 ... walls.capx

One side effect of the sprite's origin being centered is in isometric the bottom of the sprites won't line up if their heights are different. To correct this just set the isoZ of all the objects to sizeZ/2.
B
94
S
33
G
117
Posts: 5,389
Reputation: 75,339

Post » Tue Sep 29, 2015 4:01 am

Hey @R0J0hound, I seem to be getting a shadow clipping issue between tiles when using your Mario example... The shadow works fine when he jumps around within the same tile, but if he jumps over or is standing in the middle, the part of the shadow shows on one tile but not the other... Is this expected? Part of that sorting issue you mentioned?

https://www.dropbox.com/s/lq9cgwjbs2r55 ... y.png?dl=0
B
74
S
14
G
1
Posts: 152
Reputation: 5,051

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 0 guests