Update server/src/index.js
This commit is contained in:
@@ -197,8 +197,9 @@ io.on('connection', socket => {
|
|||||||
socket.on('move:click', target => {
|
socket.on('move:click', target => {
|
||||||
const p = socketsToPlayers.get(socket.id);
|
const p = socketsToPlayers.get(socket.id);
|
||||||
if (!p) return;
|
if (!p) return;
|
||||||
p.x = Math.max(0, Math.min(WORLD.width, target.x));
|
// You can store target on the server if you want later:
|
||||||
p.y = Math.max(0, Math.min(WORLD.height, target.y));
|
p.targetX = Math.max(0, Math.min(WORLD.width, target.x));
|
||||||
|
p.targetY = Math.max(0, Math.min(WORLD.height, target.y));
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('gather', async ({ nodeId }, ack) => {
|
socket.on('gather', async ({ nodeId }, ack) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user