add more map things

This commit is contained in:
rofl256 2017-06-25 21:45:31 +02:00
parent 397ef5d6e4
commit ad21fc81a0
2 changed files with 25 additions and 26 deletions

View File

@ -14,6 +14,24 @@
background: url(../img/objectlayer.png) 125px -29px;; background: url(../img/objectlayer.png) 125px -29px;;
} }
.tree1{
width: 60px;
height: 60px;
background: url(../img/objectlayer.png) 315px -70px;
}
.stone1{
width: 32px;
height: 35px;
background: url(../img/objectlayer.png) 158px -65px;
}
.fass{
width: 32px;
height: 43px;
background: url(../img/objectlayer.png) 157px -18px;
}
.water { .water {
background: url(../img/ground_tiles.png) 192px 254px; background: url(../img/ground_tiles.png) 192px 254px;
} }

View File

@ -2,31 +2,6 @@ module.exports = {
generateMap: function(width, height) { generateMap: function(width, height) {
var map = []; var map = [];
var utilMap = []; var utilMap = [];
var i = 0;
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","4","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","4","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","4","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","4","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","4","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","4","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
map[i++] = ["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"];
var g = [6,5,4,3,2]; var g = [6,5,4,3,2];
for(var k=0;k<g.length;k++) { for(var k=0;k<g.length;k++) {
@ -130,11 +105,17 @@ module.exports = {
//Set ground type //Set ground type
for(var w=0;w<width;w++) { for(var w=0;w<width;w++) {
for(var h=0;h<height;h++) { for(var h=0;h<height;h++) {
if(map[w][h] == "#") { if(map[w][h] == "#") { //is ground
map[w][h] = "6"; //set ground map[w][h] = "6"; //set ground
if(Math.random()<0.011) { if(Math.random()<0.011) {
utilMap[w][h] = "flower"; utilMap[w][h] = "flower";
} else if(Math.random()<0.011) {
utilMap[w][h] = "tree1";
} else if(Math.random()<0.011) {
utilMap[w][h] = "stone1";
} else if(Math.random()<0.011) {
utilMap[w][h] = "fass";
} }
} }
} }