Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] Going back to a previous scene

Author
Message
YarSnez
16
Years of Service
User Offline
Joined: 9th Apr 2003
Location:
Posted: 13th Aug 2019 18:00 Edited at: 16th Aug 2019 11:40
This post has been marked by the post author as the answer.
As I actually expected the problem was with my code. One of the best ways to solve a coding problem is to simplify. So I wrote a very simple test app with two scenes, one button on each and was able to go back and forth between the scenes by pressing the buttons. Here is the code in case it helps anybody



[Original Post]
Hi, I'm experimenting with scenes and was wondering how to go about having a game which would have one scene for setting game options such level of difficulty etc., and then the main scene which would be the game itself.

I would like it that from the game a player could quit and be taken back to the settings scene so they could start a new game perhaps at a different skill level.

I have tried calling the function LevelSelection_cleanup() after the user has made his or her selection (which closes the scene and deletes all the sprites) and thought I could then call LevelSelection_setup() to re-create this level selection scene when required. The problem with this approach is that I get an error message about virtual button 1 already existing in another scene. I think it's that AGKS starts creating virtual button Id's from 1 without considering if they are already in use in other scenes.

I have looked to see if there are commands for hiding scenes, but I didn't find any.

Maybe I am misunderstanding how to use scenes, but this seemed an easier way of creating user input forms that could be created and closed at will. I suppose I could design the layout with the scene editor and then copy the script and use that in my code.

Does anyone have any better ideas?

Cheers.
I have very simple tastes, I am always satisfied with the very best.

Oscar Wilde.

The author of this post has marked a post as an answer.

Go to answer

Login to post a reply

Server time is: 2019-08-26 04:48:21
Your offset time is: 2019-08-26 04:48:21