-fix endless rendering issue in firefox
This commit is contained in:
parent
af8a4ba9be
commit
ec04498d66
@ -1,5 +1,5 @@
|
||||
class Sprite{
|
||||
constructor({position, imageSrc,frames = 1,center,atPosition,sprites={up:'',down:'',left:'',right:''}}){
|
||||
constructor({position,skin, imageSrc,frames = 1,center,atPosition,sprites={up:'',down:'',left:'',right:''}}){
|
||||
this.position = position
|
||||
this.atPosition = atPosition
|
||||
this.center = center
|
||||
@ -16,6 +16,7 @@ class Sprite{
|
||||
this.elapsedFrames = 0
|
||||
this.frameBuffer = 7
|
||||
this.sprites = sprites
|
||||
this.skin = skin
|
||||
this.Up = new Image()
|
||||
this.Down = new Image()
|
||||
this.Left = new Image()
|
||||
|
@ -99,7 +99,9 @@ socket.on('updatePlayers', (bPlayers) =>{
|
||||
fPlayers[id].clickY = bPlayer.clickY
|
||||
fPlayers[id].message = bPlayer.message
|
||||
fPlayers[id].username = bPlayer.username
|
||||
spriteFunctionUpdate(fPlayers[id],bPlayer.skin)
|
||||
if(fPlayers[id].skin!=bPlayer.skin){spriteFunctionUpdate(fPlayers[id],bPlayer.skin)}
|
||||
// console.log(fPlayers[id].skin)
|
||||
// console.log(bPlayer.skin)
|
||||
// fPlayers[id].sprites = spriteFunction(bPlayer.skin)
|
||||
// console.log(fPlayers[id])
|
||||
|
||||
@ -225,6 +227,7 @@ document.querySelector('#textInput').addEventListener('submit',(event)=>{
|
||||
fPlayers[socket.id].skin = "Green";
|
||||
}
|
||||
socket.emit('skin',fPlayers[socket.id].skin);
|
||||
spriteFunctionUpdate(fPlayers[socket.id],fPlayers[socket.id].skin);
|
||||
}else{
|
||||
fPlayers[socket.id].message=document.querySelector('#input').value
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user