現在、画面の右端にタイルを描画する際に問題が発生しており、何が原因なのかわかりません。床タイルの下にリンクされている画像でわかるように、床タイルは画面の右端に移動することになっています。
これは、描画元の配列のコードのコピーです
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);
そして、これがそれを描画しているコードです
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 we must create the level
for(var i = 0;i< gameConstants.TILESACROSS; i++){
for(var j = 0; j < gameConstants.TILESDOWN; j++){
//defining a 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 = i * 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 = i * gameConstants.TILEWIDTH;
newPlacement._yPos = j * gameConstants.TILEWIDTH;
break;
case gameConstants.GOAL:
goal = new SpriteView(context);
goal.Init(iMod, mbm, iTileType);
goal._xPos = i * 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 = i * 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 = i * gameConstants.TILEWIDTH;
newPlacement._yPos = j * gameConstants.TILEWIDTH;
break;
}
}//else
}//if
}//for
}//for
};