Change scene on player collision

I’m having trouble figuring out how to change scenes based on when a player enters/collides with a certain area. I’m trying to make a JRPG-type top-down game and just want to have the player step near a door for example, which would then cause a new scene to load. Do anyone know how to do this?

Collision part, scene part, or both?

I think I can manage the actual changing of the scene as I’ve already done it a few times. I just need some guidance on player collisions and how to trigger something when the collision occurs.

Are you using Arcade Physics or no?

I am using Arcade physics yeah.

Did you figure out how?

You can check for overlap with a zone or a sprite.

For tilemaps you can also use a tile location callback.

Thanks, I got it.

If anyone wanna refer:

this.physics.world.collide(this.obj1, this.obj2, function(){
game.scene.start(‘NameOfYourGameScene’);
});

1 Like