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