开发者

converting 2d coordinates into isometric ones

Am updating a 2D game I made to have an isometric view, problem is am having issues when converting the 2d coordinates of given movieclips into isometric ones. The way I converted my game into an isometric one is just by rotating rectangular graphic 45 degrees and increasing its width such that its 2 times the height.

it looks great, but as I said, I having problems converting all my 2D coordinates into isometric ones

Is there a function to convert them, or a mathematical formula I could use? by the way the game am making is not tile based, so functions that use tiles to convert the coordinates are not going to work unfortunately.

Thanks in advance

EDIT: I managed to fix it, I just changed the alignment to be the upper left corner开发者_如何转开发, i.e. though the game is isometric and has a demimonde shape, I imagined that it is contained in a box, and that box's upper left edge is where it is aligned...this way both x and y coordinates r the same ones in both 2D and "isometric" view. This is probably only possible since my game is not tile-based as i said before, so tile based games may not work with this "fix"


Stick everything in a movieclip, keep the standard Cartesian coordinates and rotate the container movieclip 45 degrees and half the height / double the width of it.


From your edit it looks like you solved your own problem, but the most robust way to convert between coordinate systems (eg. to isometric coordinates) is using Matrix transformations:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/geom/Matrix.html

You would want to rotate and scale the matrix in the inverse of how you rotated and scaled the graphics.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜