HTML and CSS Reference
In-Depth Information
}
items.push(tempRow);
}
var randRow;
var randCol;
//placewalls
for (var wallCtr=0;wallCtr<wallMax;wallCtr++){
var wallLocationFound = false;
while(!wallLocationFound){
randRow = Math.floor(Math.random()*15);
randCol = Math.floor(Math.random()*15);
if (playField[randRow][randCol]==roadTile){
playField[randRow][randCol] = wallTile;
wallLocationFound = true;
}
}
}
//place enemy
for (var enemyCtr=0;enemyCtr<enemyMax;enemyCtr++){
var enemyLocationFound = false;
while(!enemyLocationFound){
randRow = Math.floor(Math.random()*15);
randCol = Math.floor(Math.random()*15);
if (playField[randRow][randCol]==roadTile){
enemyLocationFound = true;
var tempEnemy = {};
tempEnemy.row = randRow;
tempEnemy.col = randCol;
tempEnemy.nextRow = 0;
tempEnemy.nextCol = 0;
tempEnemy.currentTile = 0;
tempEnemy.rotation = 0;
tempEnemy.x = tempEnemy.col*32;
tempEnemy.y = tempEnemy.row*32;
tempEnemy.speed = 2;
tempEnemy.destinationX = 0;
tempEnemy.destinationY = 0;
tempEnemy.dx = 0;
tempEnemy.dy = 0;
tempEnemy.hit = false;
tempEnemy.dead = false;
tempEnemy.moveComplete = false;
enemy.push(tempEnemy);
items[randRow][randCol] = 1;
}
}
}
//place player
var playerLocationFound = false;
while(!playerLocationFound){
Search WWH ::




Custom Search