我目前在屏幕最右边绘制瓷砖时遇到问题,无法找出导致这种情况的原因。正如您在下面链接的图像中看到的那样,地砖应该会出现在屏幕的右边缘。
这是从
绘制的数组代码的副本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
};
答案 0 :(得分:1)
问题可能出在你的绘图功能中。无论何时制作块,彩虹或梯子,都要推送到vViews矢量。确保你在59个街区上加上抽奖,加上你拥有的其他许多街区。你能发布这个功能吗?