[BEHAVIOR] Isometric

  • that behavior is unbelievably good! nice work hound

  • Rojo can you add t behavior condition. if object is moving do something?

  • 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.

  • 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:

            +z
            *
            *
            *
            *
            **
          **  **
        **      **
      **          **
    +y              +x[/code:35sfwrt5]
    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:35sfwrt5]      **
        **  **
      **      **
    **          **
    * **      ** *
    *   **  **   *
    *     **     *
    *     *      *
    **    *     **
      **  *   **
        *** **
          **[/code:35sfwrt5]
    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:35sfwrt5]**
    * **
    *   **
    *     **
    *       **
    *        *
    *        *
    *        *
    **       *
      **     *
        **   *
          ** *
            **[/code:35sfwrt5]
    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:
    [url=https://dl.dropboxusercontent.com/u/5426011/examples29/iso_walls.capx]https://dl.dropboxusercontent.com/u/542 ... walls.capx[/url]
    
    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.
  • 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

  • remy-jay

    That's expected unfortunately. The shadow positioning action was just a quick solution and probably shouldn't have been included. It just puts the shadow sprite it on top of the block directly below the picked block. It only matches the correct z-order at that point.

    I don't have a better solution at this time.

  • Thanks rojohound, it's still an awesome behavior

  • Hi Again ROJO please teach me how set block to display corectly?

    I set for all blocks all same values and still blocks are sorted diferent

  • delgado

    Set the iso sizes to half the object's size. That should do it in that case.

  • Hey rojohound, do you know why pathfinding and the following line of code in your Mario example don't seem to work together nicely?

    <snippet>

    [ ] Player | Iso move by offset 90,0, Self.vz*dt

    </snippet>

    If I comment the line above out, I can pathfind (and there is no gravity -- expected)

    If I don't comment it out, pathfinding doesn't work (player doesn't move)

    Ideally, I would be able to have both gravity AND pathfinding

    I can put together an example CAPx if this doesn't make sense...

    Cheers!

    -Remy

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • remy-jay

    How are you using pathfinding? That line just moves the Sprite. So does the pathfinder but maybe it messes things up when manually moving a Sprite while it is following a path. I'm not sure.

  • Thank you

  • Great plugin!

    I have improved shadow and isoZ sorting for a bit, created some opaque system. Looks quite good.

    Thank you very much, R0J0hound !

  • XpMonster: that looks awesome.

  • R0J0hound

    Do you still maintain this plugin? I have a favor, can you please look at this error?

    I get this Javascript error:

    Cannot read property 'behavior_insts' of undefined

    rojoIsoSort_behavior.js, line 273 (col 23)

    I tried to shoot with a laser on an object. When one of the laser beams hit the object and the object get destroyed and in this moment another laser beam is still in front of the object I get this error.

    I made a little capx with the error.

    https://drive.google.com/file/d/0B5FlDY ... sp=sharing

    At the moment I change the position of the object so it is out of sight if it gets hit, but if you could fix that would be nice.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)