[BEHAVIOR] Isometric

From the Asset Store
Build your map with these isometric objects and terrains
  • Seems to be a general problem with destroying objects with this behavior. Not sure when I'll have time to really break it down and see what design flaw I used.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:390qo8fh] Not sure when I'll have time to really break it down and see what design flaw I used.

    No problem. Thanks in advance

  • Hello R0J0 hound.

    First I would like to greatly thank you for your contribution.

    I'm using it for a personal project, but I'm having trouble creating a Click&Point moving from your pathfind example

    I believe if I can convert the current coordinate of my mouse in isometric position to the original position 2D I would succeed in moving the player to mouse target, but i don't know how to convert

    There is the possibility of including a callback function in your plugin to return a 2D position starting from an isometric position?

    Or is it possible to explain to me how I can proceed to achieve this result

    thanks (^.~) sorry my bad english!

  • neoneper

    The plugin has expressions for isometric to layout position, but I guess it would be good to have conversions going the other way. For now here's the equations to do it:

    For a layout position x,y, you can find the isometric position ix, iy with this:

    ix = 0.5*x+y+iz-400

    iy = -0.5*x+y+iz-80

    You need to specify an isometric z: iz

  • Sorry for my ignorance, but I'm not succeeding!

    I tried with his equations but no success!

    I also tried this second way, but still without success!

    Look

  • neoneper

    I guess I don't understand what you're going for exactly.

    In that example there are two layers. One is a top view, and the other takes the top view positions and treats them as isometric positions.

    What I gathered from your question you wanted to be able to click on the isometric view and have that position converted to the map view. I that's the case then the equations I gave should do it.

    On mouse click

    --- player find path to 0.5*mouse.x+Mouse.y-400, -0.5*mouse.x+Mouse.y-80

  • Very Very Good Behavior thanks a lot ! i have not tried to use it yet but it's opening big "perpectives" to makes some games !

    I really hope C3 will have a simple system to make some isometric view games !

  • R0J0hound

    Firstly, this is the best custom Behaviour I have seen on Construct2. I see so many possibilities now. Honestly if you had made this a paid plugin I would be the first one to buy it

    I was working on your Pathfind CAPx, again marvelous idea! I just have one issue. WIil try to explain with an example, I am using your pathfind CAPX, I created 2D grid starting from the top left corner on the "PathFind" layer. I want my Isometric map to be fix in middle of the screen so I disabled the "Scroll to Player" action.

    When I run the project, the Isometric view starts somewhere at the middle bottom of the layout. Is there a way I can make the isometric view centered to the layout? I have set parallax to 0,0 for both layouts.

    Any help would be really appreciated!!

    Attaching screenshot for ur reference

  • SamRock

    0,0 on the map goes to 320,240 in the iso view. Do you either have to move the map or change the scroll position to a better center location.

  • SamRock

    0,0 on the map goes to 320,240 in the iso view. Do you either have to move the map or change the scroll position to a better center location.

    I used your second suggestion. Scrolled to Center of the isoview and increase size of my Layout! Thanks for the help.

    Have another question now, since I moved the scroll to center isoView within the layout. How do I translate mouse within isoView to the map grid?

    Secondly, not necessarily related to your Behaviour. But I noticed that the pathfind doesnt seem to work on narrow 32px grids. For example in my image above, when I place the "player" in the middle section, it is not able to find a path out. Do you have any suggestion?

    Lastly, thanks for your help. You have no idea how much smile you brought to me. If this work, I will have ur name all over the credit screen

  • [quote:2ap6k76q]Have another question now, since I moved the scroll to center isoView within the layout. How do I translate mouse within isoView to the map grid?

    ou can use the equation posted above:

    mapx = 0.5*x+y+iz-400

    mapy = -0.5*x+y+iz-80

    just use mouse.x(layer) an mouse.y(layer) for x and y.

    For pathfinding you can either try to shrink the grid size, use a grid based pathfinding plugin or do your own pathfinding with events.

    Searching for astar or dijkstra will give some event based examples.

  • EDIT: I realize the code in Start Layout is setting the size of the tile. Now it looks good. But I would still like to know how the iso sizes are calculated for varying heights

    R0J0hound

    Really appreciate your help. Will try this out.

    I ran into another thing. Its with the tile size. Is there a standard formula to calculate the iso Size x,y and z if the height is not same as width (in my case width is 64px and height is 52px)? I followed your mini tutorial but it didnt seem to have any effect on the output.

    Attached the tile dimension and out for your reference.

  • In your output it looks like the sprites are resized. The actual sprite size should stay the same.

  • R0J0hound

    I figured the sprite itself were not in the right isometric angle. I rendered my own tiles and now they look fine!

    I was wondering if there is someway I can restrict camera movement only within the Isometric map boundaries when my character is moving? Right now I am using scroll to player.x and y at every tick

    I am really struggling with the math

  • SamRock

    You just need to loop over all the isometric objects a find the x and y extreme positions. The scroll clamping assumes the iso objects cover more than the screen, so it uses half the screen size (320,240 in this case) to make scrolling stop at the edge.

    global number boundleft= 99999

    global number boundright= -99999

    global number boundtop= 99999

    global number boundbottom= -99999

    start of layout

    for each sprite

    --- set boundleft to min(boundleft , sprite.bboxleft)

    --- set boundright to max(boundright , sprite.bboxright)

    --- set boundtop to min(boundtop , sprite.bboxtop)

    --- set boundbottom to max(boundbottom , sprite.bboxbottom)

    every tick

    --- scroll to (clamp(scrollx, boundleft+320, boundright-320), clamp(scrolly, boundtop+240, boundbottom-240))

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