Player hopping on scene restart


#1

hi,
i have a platformer, with a matter.js player sprite, and a button that restarts the level with

this.scene.restart();

works fine, but on restart my player jumps continually until i reach another platform. do i have to destroy() something on restart? or turn an event off?


#2

What makes the player jump in the first place?


#3

thanks for your reply.

that would be keydown input. so keydown input continues after a scene has been stopped and restarted?

im wondering what all i would have to destroy() at the end of a scene. i read some posts that said events and particles, but also sprites and tilemaps? class variables?


#4

Yes, it sounds like the key is just stuck in the down state. I don’t think you need to destroy anything extra, Phaser usually does all that. If you have your state variables/properties, you should reset them.

Look in the CHANGELOG and issues for the key problem, it sounds familiar.


#5

thanks samme