From 88eb75b2483cdfc6dd9e032ab6bafc9bbeda9de9 Mon Sep 17 00:00:00 2001 From: gocivici Date: Sun, 25 Feb 2024 16:08:58 +0300 Subject: [PATCH] -new fix for rendering sprites --- public/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/public/index.js b/public/index.js index 35cfca5..878bf48 100644 --- a/public/index.js +++ b/public/index.js @@ -210,24 +210,25 @@ document.querySelector('#textInput').addEventListener('submit',(event)=>{ }else if(inputValue.includes("/dino ")){ console.log(inputValue.slice(6,7)); + var newSkin = ""; switch(inputValue.slice(6,7)) { case '1': - fPlayers[socket.id].skin = "Green"; + newSkin = "Green"; break; case '2': - fPlayers[socket.id].skin = "Red"; + newSkin = "Red"; break; case '3': - fPlayers[socket.id].skin = "Orange"; + newSkin = "Orange"; break; case '4': - fPlayers[socket.id].skin = "Blue"; + newSkin = "Blue"; break; default: - fPlayers[socket.id].skin = "Green"; + newSkin = "Green"; } - socket.emit('skin',fPlayers[socket.id].skin); - spriteFunctionUpdate(fPlayers[socket.id],fPlayers[socket.id].skin); + socket.emit('skin',newSkin); + }else{ fPlayers[socket.id].message=document.querySelector('#input').value