fix schatz
This commit is contained in:
parent
e7fccdaf6c
commit
e4fb08e375
14
server.js
14
server.js
@ -22,15 +22,15 @@ var newmap = map.generateMap(mapWidth, mapHeight);
|
||||
let schatzversteckt = false;
|
||||
let schatzcoords = { x: 0, y: 0 };
|
||||
while (!schatzversteckt) {
|
||||
for (var line = 0; line < newmap.map.length; line++) {
|
||||
for (var column = 0; column < newmap.map[line].length; column++) {
|
||||
if (newmap.map[line][column] == 4 || newmap.map[line][column] == 10) { //TODO schatz nicht im Wasser Spawnen!
|
||||
for (var line = 0; line < newmap.cssMap.length; line++) {
|
||||
for (var column = 0; column < newmap.cssMap[line].length; column++) {
|
||||
if (newmap.cssMap[line][column] == "grass") { //TODO schatz nicht im Wasser Spawnen!
|
||||
if (Math.random() < 0.1 && !schatzversteckt) {
|
||||
//console.log("versteckt", line, column)
|
||||
schatzcoords = { x: line, y: column };
|
||||
schatzcoords = { x: column, y: line };
|
||||
//newmap.utilMap[line][column] = "item_item_schatz";
|
||||
schatzversteckt = true
|
||||
console.log(schatzcoords)
|
||||
console.log(schatzcoords, newmap.cssMap[line][column])
|
||||
}
|
||||
|
||||
}
|
||||
@ -38,7 +38,7 @@ while (!schatzversteckt) {
|
||||
}
|
||||
|
||||
}
|
||||
//console.log(newmap.map)
|
||||
//console.log(newmap.cssMap)
|
||||
var cssMap = newmap["cssMap"];
|
||||
var map = newmap["map"];
|
||||
var utilMap = newmap["utilMap"];
|
||||
@ -320,7 +320,7 @@ io.on('connection', function (socket) {
|
||||
playerActionTimer = setTimeout(function () {
|
||||
|
||||
let randomItem = getRandomItem(0, 0); //Drop a random Item
|
||||
if(schatzcoords["y"] == x && schatzcoords["x"] == y) {
|
||||
if(schatzcoords["x"] == x && schatzcoords["y"] == y) {
|
||||
randomItem = "item_item_schatz"
|
||||
console.log("schatz!");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user