[SOLVED] Problem with switching scenes

There is an issue with my code: after completing level 1 of my game, level 2 does not work properly, despite having the same code.

Here’s the link for my game:
https://playcanvas.com/editor/scene/1597629

Hi @Pixels!

Can you give a bit more information about which scripts you use and what does not work properly?

I don’t know how to go to the next level when I reached the screen below.

This is the level 1 of my game:PlayCanvas | HTML5 Game Engine, but when I finished that level, the level 2 did not work, which is this one: PlayCanvas | HTML5 Game Engine. If I run level 2 alone, it does work, but when I run all the scenes, it does not.

Here’s the code that I used for my character in level 2:
https://playcanvas.com/editor/code/1007762?tabs=110382178,114572841,114331862,114560860,114575267

I like to know what is not working and how I am be able to go to the next level. Or is that the part that’s not working?

That’s the part that is not working

The scene with the screen I shared above (that I get to see when I finish level 1), doesn’t have any scripts to change the scene. Also it’s now easier to change the scene.

this.app.scenes.changeScene("Scene Name");
1 Like

Where can I see that?

Go to the scene with that screen and check the scrips you have applied. (Currently none).

The problem that I have is that when I run my game, I get stuck on Part 2 and my character stops collecting the coin despite having the same script for my character in Parts 1 and 2. but when I run Part 2 alone, it does work.

Here’s the code for switching scenes from part 1 to 2:


Please try to use the code below to change your scenes.

this.app.scenes.changeScene("Scene Name");

https://developer.playcanvas.com/en/user-manual/packs/loading-scenes/

Thank you!

1 Like