0 Favourites

# isometric Translation

• 10 posts
• Hi Guys!

I have this idea for a grid based adventure game, but I want to do it in isometric view.

I have a basic control system and engine, however, i have a problem.

Each level will be laid out in a standard grid, and then translated to the isometric projection.

But, how do I map the level layout to the isometric grid?

I thought of using an array, which then maps each element (wall, chest, door, characters, etc) to the corresponding isometric reference, but then realised i'd have to make an IF loop of sorts at the start of the level to map everything out.

Am I making this too complicated? Is there an easier method to achieve this?

(the reason i'm using a standard grid to translate to isometric is that I believe it'll be easier for me to work out movement, attack facings, and pathfinding. Plus, I feel it'll be easier to move dungeon elements around....

• Had not digging into isometric things but found nice article in Kirupa:

• I agree with you it is easier to do the motion and such is a grid view first and then map that over to isometric.

The simplest way to map it over is to have every grid object in a container with it's isometric equivalent.

Iso X = grid.x-grid.y

Iso y = (grid.x+grid.y)/2

• Hi R0J0hound

I agree that's the easiest way to map it, but it's getting them all mapped at the start of the game / each turn (at the end of the player's turn, the layout re-maps, at the end of the enemy's turn, the layout re-maps, etc) - its the re-mapping of the whole layout i'm unsure about, as I am sure i'll have to put it in a nested loop of some kind....

I know it doesn't HAVE to re-map, but it does at least have to at the start of the layout, to place the objects on the map from the grid in the first place....

Hi alextro

I shall look into that -- looks interesting!

Thanks to both of you!

• Here's an example of the idea.

• Hi Guys!

Thanks for your input - here's what I have at the moment:

the Layout view shows the basic dungeon layout, and then when you preview it, the isometric version will be shown.

You can move the sprite with the arrow keys.

Now, ideally the sprite needs to stop when it hits a wall.

The tilemap is set as a solid, but that obviously won't work with custom movement, so I am looking for a way to make this work.

Also, when the character is selected, they will only have a certain number of movement points - I was thinking of trying to use Pathfinder movement for this (i.e. making a loop to show the available number of spaces to move) - but implementing that to move round obstacles....

Again, am I making this too complex?

Is there an alternative way to do this?

To clarify:

• Make character only move a certain number of movement squares
• stop the character walking through obstacles.

Also, supplemental question - do you think the slowdown is caused by the constant Z-sorting?

Many thanks

-------------------------------------------------------------------------------------------------------

(update)

I have just realised I could do this with "ghost sprites" at each of the cardinal points

so, if player presses up, character moves up providing "up ghost-sprite" is not overlapping anything

• ## Buy Construct 3

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

Construct 3 users don't see these ads
• Using a detector sprite is usually the way to go for keeping grid motion from going into walls. You could also just check the position on the tilemap to see if it's empty (-1).

You can find some ideas ideas on how to only moving a certain number of squares by searching for "turn based" or "dijkstra".

I have an oldish example that does that here:

but the more recent topic here about flood fill pathfinding would be more useful to you:

Finally your capx is running slow because it's creating all the wall objects every tick.

• Hi there

Here's an update with the locator sprites:

I don't know what you mean by creating the walls every tick....

But it is re-ordering every tick - should I just do it every time the movement is made?

EDIT:

I just tried changing it every time a key is pressed - the character is hidden by the walls, so doing it that way doesn't seem to do anything....

Is there any way to do the Z-ordering without doing it every tick?

So there is no slow-down, I mean....

• Run it with the debugger and look at the object counts, they are increasing constantly. You need to move the events that create them to be a sub-event of start of layout.

• Ah yes, I see what you mean now.

I don't know why I did that HAHAHAHA

Fixed now

• 10 posts