You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Game.Map.prototype.getRandomFloorPosition=function(){// Randomly generate a tile which is a floorvarx,y;do{x=Math.floor(Math.random()*this._width);y=Math.floor(Math.random()*this._width);}while(this.getTile(x,y)!=Game.Tile.floorTile);return{x: x,y: y};}
You should set the y-coordinate to a random times the map height, not its width.
This may not be the best algorithm for maps with a low ratio of floors, you might want to add a counter to just set a random tile as floor tile if after x tries you still haven't found a spot.
The text was updated successfully, but these errors were encountered:
You should set the y-coordinate to a random times the map height, not its width.
This may not be the best algorithm for maps with a low ratio of floors, you might want to add a counter to just set a random tile as floor tile if after x tries you still haven't found a spot.
The text was updated successfully, but these errors were encountered: