diff --git a/js/main.js b/js/main.js index e4ac7dd..3ca6a80 100644 --- a/js/main.js +++ b/js/main.js @@ -34,12 +34,16 @@ socket.on('getmap', function (conent) { socket.on('objAction', function (obj) { console.log(obj); var mapX = obj["mapX"]*32; - var mapY = obj["mapY"]*32; - $(".overlay").remove(); - $("#main").append('
'); + var mapY = obj["mapY"]*32+3; + $(".overlay"+obj["socketId"]).remove(); + $("#main").append(''); }); +socket.on('stopAction', function (socketId) { + $(".overlay"+socketId).remove(); +}); + socket.on('removeUtil', function (obj) { console.log(obj); $("."+obj["mapY"]+'-'+obj["mapX"]+'.'+obj["name"]).remove(); @@ -214,9 +218,6 @@ $(document).ready(function() { $( document ).keyup(function( event ) { var key = event.which; socket.emit("keyUp", key ); - if(key==32) { - $(".overlay").remove(); - } keys[key] = false; }); diff --git a/server.js b/server.js index ade4f87..2bd0e3d 100644 --- a/server.js +++ b/server.js @@ -62,6 +62,7 @@ io.on('connection', function(socket){ clearTimeout(playerActionTimer); playerActionTimer = null; } + io.sockets.emit("stopAction", socket.id); } });