Isometric Coordinate Conversions Extension

merrak

  • *
  • Posts: 2738
Isometric Computation Tools
Works on Flash and Linux. Untested on iOS, Android, and Mac

This is an extension to perform routine calculations when converting from scene (screen) coordinates to coordinates in an environment with isometric projection. It allows for quick conversion back and forth between both coordinate systems. It also supports isometric tiles, rows and columns, and custom placement of the environment's origin in the scene.



Example game using this extension: http://www.stencyl.com/game/play/30916

You can download the packages at my site (see "Documentation" section), or at the links below:

Get it

- ZIP file
- TAR.GZ file

(How to Install and Update an Extension)


Documentation

The full documentation is on my site: http://www.anorthogonaluniverse.com/public-code/isometric.php, and includes a full function reference.



Version History

Use this section to record updates and changes to the extension.

« Last Edit: May 23, 2015, 10:54:07 am by merrak »

mdotedot

  • Posts: 1654
Hello Merrak,

This looks awesome. Thank you for your work. I ran the demonstration you have in your profile/arcade and I suggest you put that in the post as well so that we can see what we can make with this cool extension.

Right now I have a lot on my plate, but maybe a future Ludum Dare would be perfect to play with this!

Thanks again for your efforts.

Best regards from
M.E.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

merrak

  • *
  • Posts: 2738
Hello Merrak,

This looks awesome. Thank you for your work. I ran the demonstration you have in your profile/arcade and I suggest you put that in the post as well so that we can see what we can make with this cool extension.

Right now I have a lot on my plate, but maybe a future Ludum Dare would be perfect to play with this!

Thanks again for your efforts.

Best regards from
M.E.

Thanks for taking a look! I added a link to the arcade game, although it is using an older version of the extension that had a hard-coded origin.

merrak

  • *
  • Posts: 2738
Update - Version 0.91

Released an update to this toolset.

* Bug fix: xSceneAtRC and ySceneAtRC had row/col flipped. These functions are at lines 86 and 91, and should read:

Code: [Select]
    /*
        Convert from grid row,column to scene coordinates
    */

    public static function xSceneAtRC( row:Int, col:Int ):Int
    {
        return xSceneAtGridXY( col * tileSize, row * tileSize );
    }

    public static function ySceneAtRC( row:Int, col:Int, level:Int ):Int
    {
        return ySceneAtGridXYZ( col * tileSize, row * tileSize, level * levelHeight );
    }

Correction has been applied to the download on my site.

LIBERADO

  • *
  • Posts: 2720
Thank you so much, @merrak. This useful extension really facilitates the work.

« Last Edit: January 24, 2016, 09:18:53 pm by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

merrak

  • *
  • Posts: 2738
You're welcome! This extension is due for an overhaul; once I get to a good stopping point on my current project, I'm going to revisit the isometric game (and this extension). If you feel any features are missing, please let me know :)

addable13

  • Posts: 17
can you explain in more detail how to use this extension?

merrak

  • *
  • Posts: 2738
can you explain in more detail how to use this extension?

One approach to making an isometric game with Stencyl is to double up on the number of actors. Let's take the player for example. The player is represented by two actors: a "physics" actor and an "image" actor. The physics actor is invisible and moves around in the scene. The image actor is drawn at a position determined by where the physics actor is.

It's an idea I got from captaincomic. You can see it illustrated here: http://community.stencyl.com/index.php?topic=10613.0

The primary function of this extension is to do the math needed to convert between the two coordinate systems. You're still on your own to set up rendering, computing the drawing order, etc. The example project should illustrate one way to do that, though. There are other ways, too. I wrote about a couple other approaches I experimented with in the journals forum.

« Last Edit: February 21, 2018, 03:19:14 pm by merrak »