This code will not print our the roomC instead it returns nan I have traced back through the code and determined that the code
var minR = (Game.height * Game.width) / 300;
var maxR = (Game.height * Game.width) /150;
causes nan to occur here is the entirety of the code any help would be appreciated!
Game = {
mapG:{
width: 75,
height: 50,
tile:{
width: 10,
height: 10
}
},
width: function() {
return this.mapG.width * this.mapG.tile.width;
},
height: function() {
return this.mapG.height * this.mapG.tile.height;
},
start: function() {
var minR = (Game.height * Game.width) / 300;
var maxR = (Game.height * Game.width) /150;
var range = maxR - minR + 1;
var roomC = Math.floor((Math.random()*maxR)+minR);
//#3L11Tw0w0w0w0
Crafty.init(Game.width(), Game.height());
Crafty.background('rgb(6, 38, 111)');
var map =[];
for(var x = 0; x < 100; x++){
map[x] = [];
for(var y = 0; y < 100; y++){
map[x][y] = x*y;
}
}
console.log(map[10][11]);
//Need this to print out!
console.log(roomC);
}
}