close

game={tileW:30};
char={xtile:2, ytile:1, speed:4, width:16, height:16};
Biggest change in the code will be actual placement of movie clips on screen. In normal view, we used clip._x=x and clip._y=y, to make same x/y appear in isometric view, we will use:

clip._x=x-y;
clip._y=(x+y)/2;
In the buildMap function change placement of tiles:

clip[name]._x = (j-i)*game.tileW;
clip[name]._y = (j+i)*game.tileW/2;
Tiles depth is calculated same way as before, but we wont use x/y, we will use tiles new coordinates in isometric view:

game[name].depth=(j+i)*game.tileW/2*300+(j-i)*game.tileW+1;
And same thing for the hero:

var ob=char;
ob.x = ob.xtile*game.tileW;
ob.y = ob.ytile*game.tileW;
ob.xiso = ob.x-ob.y;
ob.yiso = (ob.x+ob.y)/2;
ob.depthshift=(game.tileW-ob.height)/2;
ob.depth=(ob.yiso-ob.depthshift)*300+ob.xiso+1;
game.clip.attachMovie("char", "char", ob.depth);
ob.clip=game.clip.char;
ob.clip._x = ob.xiso;
ob.clip._y = ob.yiso;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 45 的頭像
    45

    FIVE

    45 發表在 痞客邦 留言(0) 人氣()