Page 1 of 1

Help with isometric map tiling

Posted: Sat Jan 09, 2010 11:30 am
by Jonas.mi
Hey!
First of all. Im new here, so hi everyone im Jonas. And i believe you will get to see alot of me lol :)
Now for my question.

I'm sitting here with a little problem. I would like to have this loop, that execute a gamemap for isometric in a Zig-Zag layout (A diamond layout would be nice 2. Or both if you know how to.)

the problem is i cant get it to work out!

Img-Length: 64
Img-Height: 32

If you know how to make a Diamond layout. i would like that one aswell.

Here is the code i made up yesterday (Ofcourse it dont work. Was really tired 2 so might be some weird stuff lol)
But im sure, that it's possible to make it 100 times easier.

Code: Select all

function MakeWorkSpace($Lsize, $Hsize, $Name) {
    $TotalSize = $Lsize * $Hsize;
    $j = 0;
    $k = 0;
    $i = 0;
    $pos_l = 0;
    $pos_t = 0;
 
    $count1 = 0;
    $count2 = 0;
    $less = FALSE;
    
for ($i = 0; $i <= $TotalSize; $i++) {
    
 
            for ($j = 0; $j <= Lsize; $j++) {
print '<div id="'.$i.'" style="background-image:url(image/Untitled-9.gif); z-index:'.$i.'; width:64px; height:32px; position:absolute; left:'.$pos_l.'px; top:'.$pos_t.'px;"></div>';
$pos_l = $pos_l + 64;
 
        if ($j <= $Lsize) {
            $pos_t = $pos_t + 16;
            $pos_l = 32;
            
 
        }
            }
            
            for ($k = 0; $k <= $Lsize -1; $k++) {
                
                print '<div id="'.$i.'" style="background-image:url(image/Untitled-9.gif); z-index:'.$i.'; width:64px; height:32px; position:absolute; left:'.$pos_l.'px; top:'.$pos_t.'px;"></div>';
                $pos_l = $pos_l + 32;
                
                if($k <= $Lsize -1) {
                    $pos_t = $pos_t +16;
 
                }
                
            }
    
 
 
}
 
 
}
As i said before, im sure it is possible to make easier.
And also, once again. If you dont know how to make the Zig-Zag, but know how a Diamond shape tileset is made please feel free to post that one 2! Or if you know both post both i will appreciate alot.

Many thanks, and appreciations Jonas :D

Re: Help with isometric map tiling

Posted: Sun Jan 10, 2010 1:02 am
by manohoo
I would like to have this loop, that execute a gamemap for isometric in a Zig-Zag layout (A diamond layout would be nice 2. Or both if you know how to.)
I am not familiar with the jargon you are using, but if you clearly describe the desired output someone might be able to help you.

Re: Help with isometric map tiling

Posted: Sun Jan 10, 2010 9:34 am
by Jonas.mi
I'm sorry. I believe i cleared it out from start.

I have those "Tiles" Diamond shaped images (Grass, Dirt, Stone, Water). I would like a script, to output them into a Zig-Zag and or Diamond shape.

The Zig-Zag shape goes like this EX:
5 5 5 5 5 5
5 5 5 5 5
5 5 5 5 5 5

So having Ex: 5 images in top.
Go half of that picturesize down (16px) And 1½ picture in and place the next. so it makes a full tileset.


With the diamond its like this
*
***
*****
***
*

I hope you understand. Its all about Z-indexing and positioning the tiles. Tiles Height and Length u can see in first post.

Also look at my code, you will be able to get the idea from there.

Thanks in advance
jonas