HTML5/ Javascript not drawing tiles on the far right side of screen -
i having issues drawing tiles @ far right of screen , cant figure out causing this. can see in image linked below floor tiles supposed going right edge of screen.
here copy of code array drawing
var maparray1 = new array(); // 05| 10| 15| 20| maparray1[0] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[1] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[2] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[3] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[4] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 61, 00, 00, 00, 00, 33, 00, 00, 43); // maparray1[5] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 01, 21, 01, 01, 00, 00, 00, 01, 01, 01, 01, 01); maparray1[6] = new array(00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 21, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[7] = new array(00, 00, 00, 00, 63, 00, 00, 00, 00, 00, 00, 00, 00, 00, 21, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[8] = new array(01, 01, 01, 01, 01, 01, 01, 00, 00, 00, 00, 00, 00, 00, 21, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00); maparray1[9] = new array(00, 00, 00, 00, 00, 00, 02, 00, 00, 00, 00, 00, 00, 00, 21, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02); //10 maparray1[10] = new array(00, 00, 00, 00, 00, 00, 02, 00, 00, 00, 00, 00, 00, 00, 21, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02); maparray1[11] = new array(00, 00, 00, 00, 00, 00, 02, 00, 00, 00, 00, 00, 01, 01, 01, 01, 01, 00, 01, 21, 01, 01, 01, 01, 02); maparray1[12] = new array(00, 00, 00, 00, 00, 00, 02, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 21, 00, 00, 00, 00, 00); maparray1[13] = new array(00, 00, 00, 00, 50, 00, 02, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 21, 00, 41, 00, 00, 00); maparray1[14] = new array(01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01);
and here code drawing
function createblock(tileint, column, row, bm){ var tilewidth = gameconstants.tilewidth; var blockmodel = new averletmodel(); blockmodel._xpos = column * tilewidth + tilewidth/2; blockmodel._ypos = row * tilewidth + tilewidth/2; blockmodel.setrectangle(tilewidth, tilewidth, 0xff7777); vblocks.push(blockmodel); var blockview = new averletview(context); blockview.init(blockmodel, bm, tileint); vviews.push(blockview); } function createlvl(mbm, obm, ebm){ //console.log("createlvl"); //now must create level for(var = 0;i< gameconstants.tilesacross; i++){ for(var j = 0; j < gameconstants.tilesdown; j++){ //defining target var newplacement; var itileint = mmap.gettile(currentmap, j, i); var itiletype = math.round(itileint / 10); var imod = itileint % 10; if(itileint != 0){ if(itileint < 10){ createblock(itileint, i, j, mbm); } else if(itiletype == gameconstants.enemy){ console.log("enemy"); //createenemy(imod, i, j, ebm); } else{ switch(itiletype){ case gameconstants.orb: newplacement = new spriteview(context); newplacement.init(imod, obm, itiletype); vorbs.push(newplacement); newplacement._xpos = * gameconstants.tilewidth; newplacement._ypos = j * gameconstants.tilewidth; break; case gameconstants.ladder: newplacement = new spriteview(context); newplacement.init(imod, obm, itiletype); vviews.push(newplacement); newplacement._xpos = * gameconstants.tilewidth; newplacement._ypos = j * gameconstants.tilewidth; break; case gameconstants.goal: goal = new spriteview(context); goal.init(imod, mbm, itiletype); goal._xpos = * gameconstants.tilewidth; goal._ypos = j * gameconstants.tilewidth; break; case gameconstants.rainbow: newplacement = new spriteview(context); //console.log(newplacement.currenttile); newplacement.init(5, obm, itiletype); vviews.push(newplacement); newplacement._xpos = * gameconstants.tilewidth; newplacement._ypos = j * gameconstants.tilewidth; break; case gameconstants.gems: newplacement = new spriteview(context); newplacement.init(imod, obm, itiletype); vgems.push(newplacement); newplacement._xpos = * gameconstants.tilewidth; newplacement._ypos = j * gameconstants.tilewidth; break; } }//else }//if }//for }//for };
the problem might in draw function. pushing vviews vector whenever make block, rainbow, or ladder. sure calling draw on 59 blocks plus many of others have. can post function?
Comments
Post a Comment