Changing scenes is weird

Instead of opening level 2, it jumps straight to the game win screen. I have no idea why it’s like that. I already fixed the root problem but now this is the problem I’m trying to solve but I honestly don’t know how.

here’s the link to my project: PlayCanvas 3D HTML5 Game Engine

Also when you go back to start the level, the moment it absorbs one collectible, it immediately shows the congrats & game win screen:“)) idk what I’m doing anymore:”))

1 Like

I recommend you do not use numbers for your scene names, instead use things like one, and two. And make sure the collision is not touching your player at the start of the scene.

i tried your advice and it’s still the same:((

Remember you also have to change the names of the scene change in your script. Could you show me the code? It would also be helpful to know which specific scene is level one, the names are a bit confusing.

i’m assuming the problem is in the gameBar script since this is the one inside level2

when the scene prior changes to the next level (by clicking ‘enter’), instead of showing level 2 to
play it, it immediately jumps to the GameWin screen:")))

here’s the code for the scene before (aka ‘congrats’ scene) level 2
Screenshot 2023-12-09 003844

1 Like

Why are you destroying scenes?

the codes work if level 2 was launched on its own, however, if it’s launched from the very start of the game, the code does not work…:")) (honestly i have no idea what I’m doing anymore)

Just use a change scene script instead'yourscene');

where do i substitute this??><

replace load scene

the difference it made was that it showed level 2 for a split second but it still immediately changed to the Game Win scene…

Where or how do you set objectCounter?

feel free to check my project:">>

Sorry, but the project has too much scenes to easily check.

As the value of objectCounter is responsible for the winning, I would check if this value is as expected.

it’s like this><
Screenshot 2023-12-09 034432

Are you sure objectCounter is not immediately 4?

How or where do you count it?

the var = objectCounter at the top is in zero, do i have to reset it when the game refreshes?? it counts when it absorbs the collectible

update: I tried changing the var = objectCounter to var = objectCounter2. Level 2 is playable now however, this time, it doesn’t display the Game Win scene when all four collectibles are collected:")))

I guess this is going wrong, so can you share the code?


I can’t see where you increase the value of objectCounter here?