HTML and CSS Reference
In-Depth Information
randRow = Math.floor(Math.random()*15);
randCol = Math.floor(Math.random()*15);
if (playField[randRow][randCol]==roadTile &&
items[randRow][randCol]==0){
playerLocationFound = true;
player.col = randCol;
player.row = randRow;
player.x = player.col*32;
player.y = player.row*32;
items[randRow][randCol] = 1;
}
}
//place goal
var goalLocationFound = false;
while(!goalLocationFound){
randRow = Math.floor(Math.random()*15);
randCol = Math.floor(Math.random()*15);
if (playField[randRow][randCol]==roadTile &&
items[randRow][randCol]==0){
playField[randRow][randCol] = goalTile;
goalLocationFound = true;
}
}
//console.log("playField=" + playField);
}
function resetPlayer(){
player.row = 0;
player.col = 0;
player.nextRow = 0;
player.nextCol = 0;
player.currentTile = 0;
player.rotation = 0;
player.speed = 2;
player.destinationX = 0;
player.destinationY = 0;
player.x = 0;
player.y = 0;
player.dx = 0;
player.dy = 0;
player.hit = false;
player.dead = false;
player.win = false;
}
function gameStateWaitForPlayerMove() {
if (keyPressList[38]==true){
//up
if (checkBounds(-1,0, player)){
setPlayerDestination();
Search WWH ::




Custom Search