SkyOffice icon indicating copy to clipboard operation
SkyOffice copied to clipboard

MyPlayer frozen when Game scene restart or reloaded

Open loveomg opened this issue 2 years ago • 0 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?

loveomg avatar Jul 01 '22 16:07 loveomg