graben auf G und Knochen
This commit is contained in:
parent
71c86ecb6b
commit
1862fcd955
10
css/main.css
10
css/main.css
@ -295,6 +295,14 @@
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item_item_spaten3 {
|
||||||
|
background: url(../img/items.png) -59px -149px;
|
||||||
|
width: 30px;
|
||||||
|
background-size: 476px;
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.item_weapon_stick1 {
|
.item_weapon_stick1 {
|
||||||
background: url(../img/items.png) -150px -91px;
|
background: url(../img/items.png) -150px -91px;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
@ -303,7 +311,7 @@
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item_item_bone1 {
|
.item_item_bone0 {
|
||||||
background: url(../img/items.png) -356px -29px;
|
background: url(../img/items.png) -356px -29px;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
background-size: 476px;
|
background-size: 476px;
|
||||||
|
17
js/main.js
17
js/main.js
@ -39,7 +39,8 @@ var tooltiptexts = {
|
|||||||
"item_weapon_sword4": "Schwert: Schaden erhöht 500",
|
"item_weapon_sword4": "Schwert: Schaden erhöht 500",
|
||||||
"item_weapon_sword5": "Schwert: Schaden erhöht 600",
|
"item_weapon_sword5": "Schwert: Schaden erhöht 600",
|
||||||
"item_weapon_stick1": "Stock: Schaden +20",
|
"item_weapon_stick1": "Stock: Schaden +20",
|
||||||
"item_item_bone1": "Knochen: Schaden +5",
|
"item_item_bone0": "Ganz toller Knochen!",
|
||||||
|
"item_item_spaten3": "Spaten: Schneller graben",
|
||||||
"item_consumable_fish1": "Erhöht deine Lebenspunkte um 20",
|
"item_consumable_fish1": "Erhöht deine Lebenspunkte um 20",
|
||||||
"item_consumable_fish2": "Erhöht deine Lebenspunkte um 10",
|
"item_consumable_fish2": "Erhöht deine Lebenspunkte um 10",
|
||||||
"item_item_dimond1": "Verkaufe den Diamand für 10 Siegpunkte! Bewegungsgeschwindigkeit verlangsamt!",
|
"item_item_dimond1": "Verkaufe den Diamand für 10 Siegpunkte! Bewegungsgeschwindigkeit verlangsamt!",
|
||||||
@ -363,13 +364,9 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).keydown(function (event) {
|
$(document).keydown(function (event) {
|
||||||
//console.log(event.which)
|
|
||||||
if (event.ctrlKey == true && (event.which == '61' || event.which == '107' || event.which == '173' || event.which == '109' || event.which == '187' || event.which == '189')) {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
var key = event.which;
|
var key = event.which;
|
||||||
//console.log(key);
|
//console.log(key);
|
||||||
if (key == 37 || key == 38 || key == 39 || key == 40)
|
if (key == 37 || key == 38 || key == 39 || key == 40 || key == 71)
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (!keys[key]) {
|
if (!keys[key]) {
|
||||||
|
|
||||||
@ -379,13 +376,19 @@ $(document).ready(function () {
|
|||||||
socket.emit("keyDown", key);
|
socket.emit("keyDown", key);
|
||||||
}
|
}
|
||||||
keys[key] = true;
|
keys[key] = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
//console.log(event.which)
|
||||||
|
if (event.ctrlKey == true && (event.which == '61' || event.which == '107' || event.which == '173' || event.which == '109' || event.which == '187' || event.which == '189')) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).keyup(function (event) {
|
$(document).keyup(function (event) {
|
||||||
var key = event.which;
|
var key = event.which;
|
||||||
socket.emit("keyUp", key);
|
socket.emit("keyUp", key);
|
||||||
if (key == 69) {
|
if (key == 69 || key == 71) {
|
||||||
$("#animationDiv").remove();
|
$("#animationDiv").remove();
|
||||||
}
|
}
|
||||||
keys[key] = false;
|
keys[key] = false;
|
||||||
|
51
server.js
51
server.js
@ -148,9 +148,11 @@ var itemAttrs = {
|
|||||||
lvl: 1,
|
lvl: 1,
|
||||||
dmg: 20
|
dmg: 20
|
||||||
},
|
},
|
||||||
"item_item_bone1": {
|
"item_item_bone0": {
|
||||||
|
lvl: 0,
|
||||||
|
},
|
||||||
|
"item_item_spaten3": {
|
||||||
lvl: 1,
|
lvl: 1,
|
||||||
dmg: 5
|
|
||||||
},
|
},
|
||||||
"item_consumable_fish1": {
|
"item_consumable_fish1": {
|
||||||
lvl: 3,
|
lvl: 3,
|
||||||
@ -165,7 +167,7 @@ var itemAttrs = {
|
|||||||
changeMovementSpeed: -0.5
|
changeMovementSpeed: -0.5
|
||||||
},
|
},
|
||||||
"item_item_woods1": {
|
"item_item_woods1": {
|
||||||
lvl: 0,
|
lvl: 1,
|
||||||
//changeMovementSpeed: -0.5
|
//changeMovementSpeed: -0.5
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -241,7 +243,7 @@ io.on('connection', function (socket) {
|
|||||||
|
|
||||||
socket.on('keyUp', function (key) {
|
socket.on('keyUp', function (key) {
|
||||||
allPlayers[socket.id]["keys"][key] = false;
|
allPlayers[socket.id]["keys"][key] = false;
|
||||||
if (key == 69) { //space
|
if (key == 69 || key == 71) { //space oder G
|
||||||
player["action"] = false;
|
player["action"] = false;
|
||||||
if (playerActionTimer) {
|
if (playerActionTimer) {
|
||||||
clearTimeout(playerActionTimer);
|
clearTimeout(playerActionTimer);
|
||||||
@ -269,11 +271,50 @@ io.on('connection', function (socket) {
|
|||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
|
} else if (key == 71) { // Taste G
|
||||||
|
var groundUnder = getGroundUnderPlayer(player["x"], player["y"]);
|
||||||
|
if (groundUnder == 10) { //its land
|
||||||
|
let cutTime = 6000; //6 Secs
|
||||||
|
console.log(player)
|
||||||
|
if(player["slots"] && player["slots"]["item"] && player["slots"]["item"] == "item_item_spaten3") {
|
||||||
|
cutTime = 2000;
|
||||||
|
}
|
||||||
|
if (playerActionTimer) {
|
||||||
|
clearTimeout(playerActionTimer);
|
||||||
|
playerActionTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
playerActionTimer = setTimeout(function () {
|
||||||
|
|
||||||
|
//Drop a random Item
|
||||||
|
let randomItem = getRandomItem(0, 0);
|
||||||
|
let nearFieldCoords = getNearEmptyField(Math.floor(player["x"] / 32), Math.floor(player["y"] / 32));
|
||||||
|
|
||||||
|
utilMap[nearFieldCoords["y"]][nearFieldCoords["x"]] = randomItem;
|
||||||
|
let newObj = {
|
||||||
|
mapY: nearFieldCoords["y"],
|
||||||
|
mapX: nearFieldCoords["x"],
|
||||||
|
newName: randomItem
|
||||||
|
}
|
||||||
|
io.sockets.emit("dropItem", newObj);
|
||||||
|
|
||||||
|
socket.emit("stopAnimation", cutTime);
|
||||||
|
allPlayers[socket.id]["action"] = false;
|
||||||
|
|
||||||
|
}, cutTime);
|
||||||
|
allPlayers[socket.id]["action"] = true;
|
||||||
|
socket.emit("animation", cutTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
console.log(groundUnder)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('actionKey', function (key) {
|
socket.on('actionKey', function (key) {
|
||||||
var groundUnder = getGroundUnderPlayer(player["x"], player["y"]);
|
var groundUnder = getGroundUnderPlayer(player["x"], player["y"]);
|
||||||
|
if (key == 69) {// E
|
||||||
|
|
||||||
if (player["mode"] == 0) { //ship
|
if (player["mode"] == 0) { //ship
|
||||||
if (groundUnder >= 1) { //its nearly land
|
if (groundUnder >= 1) { //its nearly land
|
||||||
player["mode"] = 1;
|
player["mode"] = 1;
|
||||||
@ -395,6 +436,7 @@ io.on('connection', function (socket) {
|
|||||||
|
|
||||||
io.sockets.emit("objAction", obj);
|
io.sockets.emit("objAction", obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
player["action"] = true;
|
player["action"] = true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -439,6 +481,7 @@ function calcDmgAndHitPlayer(player1, player2) {
|
|||||||
|
|
||||||
function getRandomItem(minLvl, maxLvl) {
|
function getRandomItem(minLvl, maxLvl) {
|
||||||
//console.log("rnd", items.length, getRandomNumber(0, items.length), items)
|
//console.log("rnd", items.length, getRandomNumber(0, items.length), items)
|
||||||
|
// return items[32] //Spaten
|
||||||
// return items[32] //fish
|
// return items[32] //fish
|
||||||
while (1) {
|
while (1) {
|
||||||
let item = items[getRandomNumber(0, items.length)];
|
let item = items[getRandomNumber(0, items.length)];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user