kevinshen56714 / SkyOffice

Immersive virtual office built with Phaser, React, Redux, PeerJS, and Colyseus.

Home Page:https://sky-office.co/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MyPlayer frozen when Game scene restart or reloaded

loveomg opened this issue · comments

Hi everyone~
I am really happy to know this great project

Nowdays I am making custom maps for Skyoffice
Its very easy to make new maps and load them into Skyoffice

But whenever I load new maps or restart Game scene, MyPlayer frozen.. I can't move my avatar
It caused by previous MyPlayer collider and other colliders
I tried hundreds of way to remove old colliders
unfortunately, it failed...

Bellow is my codes for restart Game scene from MyPlayer.ts

this.scene.input.keyboard.resetKeys()
this.scene.input.keyboard.shutdown()      
this.scene.physics.world.colliders.destroy()  
			
//this.physics.world.removeCollider([this.myPlayer, this.myPlayer.playerContainer])
//this.physics.world.removeCollider([this.myPlayer, this.myPlayer.playerContainer], groundLayer2)
//this.physics.world.removeCollider([this.myPlayer, this.myPlayer.playerContainer], vendingMachines)
//this.physics.world.removeCollider([this.myPlayer, this.myPlayer.playerContainer], gameMachines)
//this.physics.world.removeCollider([this.myPlayer, this.myPlayer.playerContainer], doors)
			
this.scene.scene.stop('game')
this.scene.scene.restart( {
	network: network
})

How can I make my Avatart works after restart or start again?