mm Posted July 18, 2018 Share Posted July 18, 2018 Hello, I just started doing test with phaser 3, so far is been really good. I'm having issues with sounds when changing scenes, lets call them "scene 1" and "scene 2", "scene 2" has a looping sound, when I go from "scene 1" to "scene 2" and back to "scene 1" the sound loop keeps playing in "scene 1", also if I repeat the process again the sound not only keeps looping but duplicates so I end up with two sound loops in "scene 1". Is there a way to clearing a scene when changing to another? I'm using Phaser 3.11 btw. Thanks. Link to comment Share on other sites More sharing options...
NoxBrutalis Posted July 18, 2018 Share Posted July 18, 2018 You're in the wrong forum, bro Link to comment Share on other sites More sharing options...
mm Posted July 23, 2018 Author Share Posted July 23, 2018 isn't this Phaser3 forum? Link to comment Share on other sites More sharing options...
NoxBrutalis Posted July 23, 2018 Share Posted July 23, 2018 It's the right one now. A mod must've moved this over into the correct place, you were in the bit where people share projects and plugins and things. What I do in my current game, is I have a seperate scene called the audio manager, that way the background music and sounds are not linked to the scenes changing during gameplay as such. Its the same concept as a preload scene. You may already know, but in phaser 3 you can have many scenes, but also ones that run at the same time. Link to comment Share on other sites More sharing options...
mm Posted July 24, 2018 Author Share Posted July 24, 2018 That's a good solution, will also help with separating game and audio pause, thank you @NoxBrutalis. This gives me some more doubts about scene management: - When I change a scene, what parts of it keeps working? looks like audio keeps working, what about sprites? timers? script logic? - How can I clean/delete a scene on change? NoxBrutalis 1 Link to comment Share on other sites More sharing options...
NoxBrutalis Posted July 24, 2018 Share Posted July 24, 2018 Last time I checked, animations remain and so when restarting scenes you often get warnings saying they're already defined. At the minute for the main file of my game, I have a separate initialise functions, that resets things manually, but I know a lot of people - including Rich, the main dev, use a separate scene for animations and various other assets. This is in part because they can use the scene as a splash screen to load things in a more seamless manner I think, but it has the added benefits, such as no warnings, and the ability to restart and swap scenes without the issues you're worried about. I've not read through this myself, so sorry if it's not the same thing, but I think it is https://phaser.io/news/2018/05/phaser-3-preloader-tutorial Otherwise, I can't offer any more advise, alot of the things you mentioned, I'm not sure about. I think the scene changing etc is a bit sketchy. It's still fairly early days for phaser 3 at the minute. Link to comment Share on other sites More sharing options...
mm Posted July 25, 2018 Author Share Posted July 25, 2018 Thanks for your help, certainly help me get into the correct direction to implement scene changes. Link to comment Share on other sites More sharing options...
Recommended Posts