Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am new to isometric and game programming in general.

Just cannot figure out how to iterate the grid from behind. I want to do it so that the tiles overlap properly.

My grid starts at [0][0] which translates into the tile closest to the left edge.

This is how my a smaller version of my map grid looks like:

var map = [
[1, 1, 1],
[1, 0, 0],
[1, 1, 1]
];

I have no trouble displaying it when I loop forward through the arrays: enter image description here

But when I try to iterate backwards through the Y array, it starts bugging, and does not display all tiles and have no clue why: enter image description here

I hope the images are large enough, else please "Zoom in" or open them in a new tab.

Cheers

share|improve this question

closed as too localized by Byte56, bummzack, Trevor Powell, Josh Petrie, Anko Apr 8 '13 at 8:31

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 2 down vote accepted

You're not drawing for y==0 in the second loop. That's why you don't have everything.

You can fix your loop as

for (var y=map.length-1; y>=0; y--) {

or more concise :

for (var y=map.length; y-->0;) {
share|improve this answer
    
Oh! So simple! thank you :) –  Oliver Schöning Mar 11 '13 at 9:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.