isometric Translation

Get help using Construct 2

Post » Tue Apr 19, 2016 7:21 pm

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....
B
6
Posts: 30
Reputation: 298

Post » Tue Apr 19, 2016 10:29 pm

Had not digging into isometric things but found nice article in Kirupa:
https://www.kirupa.com/developer/isometric/index.htm
ImageImage
B
111
S
51
G
24
Posts: 787
Reputation: 23,394

Post » Wed Apr 20, 2016 2:53 am

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
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Wed Apr 20, 2016 7:48 am

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!
B
6
Posts: 30
Reputation: 298

Post » Wed Apr 20, 2016 7:15 pm

B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Mon Apr 25, 2016 3:04 pm

Hi Guys!

Thanks for your input - here's what I have at the moment:
https://www.dropbox.com/s/rqjkhvkoebdf6 ... .capx?dl=0

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
B
6
Posts: 30
Reputation: 298

Post » Mon Apr 25, 2016 6:06 pm

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:
sequential-grid-based-movement_p695580?#p695580
but the more recent topic here about flood fill pathfinding would be more useful to you:
flood-fill-and-path-finding_p1024670?#p1024670

Finally your capx is running slow because it's creating all the wall objects every tick.
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Mon Apr 25, 2016 7:24 pm

Hi there
Here's an update with the locator sprites:
https://www.dropbox.com/s/rqjkhvkoebdf6 ... .capx?dl=0

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....
B
6
Posts: 30
Reputation: 298

Post » Mon Apr 25, 2016 8:32 pm

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.
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Tue Apr 26, 2016 1:19 pm

Ah yes, I see what you mean now.
I don't know why I did that HAHAHAHA
Fixed now :D
B
6
Posts: 30
Reputation: 298


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests