Pause and Reset scene help
After doing hours of researching on the forum, I have come to the conclusion that I still don't understand how to work this.
Basically I'm making an endless runner game and everything was going perfectly until I reached the point where I needed to make a reset or restart button. In my game, I have made it so if the pause button is pressed, it changes to the pause scene. And on the pause scene, I have a restart button which I would like for when it is pressed, it resets or restarts the previous scene (which is the main gaming area) back to default so the player can start the game all over again with the score and everything set to zero.
Upon searching on this forum, I gathered that, to make this happen, I need to set all my attributes to default, for some reason I'm not sure how to do this, so if anyone have an idea of how to reset a previous scene to default from a current screen, please kindly help me out. I will really appreciate this. thanks. I'm new and trying to make my first ever game.
Basically I'm making an endless runner game and everything was going perfectly until I reached the point where I needed to make a reset or restart button. In my game, I have made it so if the pause button is pressed, it changes to the pause scene. And on the pause scene, I have a restart button which I would like for when it is pressed, it resets or restarts the previous scene (which is the main gaming area) back to default so the player can start the game all over again with the score and everything set to zero.
Upon searching on this forum, I gathered that, to make this happen, I need to set all my attributes to default, for some reason I'm not sure how to do this, so if anyone have an idea of how to reset a previous scene to default from a current screen, please kindly help me out. I will really appreciate this. thanks. I'm new and trying to make my first ever game.
Comments
I reset the attributes manually. I only have two or three (no of kicks, score, and lives) so didn't need to reset the scene. I found when I reset the scene the ball started off screen and dropped. Never did look at why I did that.
My actors had rules on them to position themselves on the floor when lives equals 3 and no kicks equals 0 so that meant I didn't have to do a reset scene to re-position those.
And to anyone having the same issue as me, all you have to do is to create 2 Game Boolean attributes (Name 1 DefaultPosition and the other 1 GameOver). Then after you go inside your reset or restart button or gameover screen or any button you have or your play button, and then make a change attribute for each item that you wanna set to default settings.
For example 1:
if you wanted to change the score of my game to its default number 0 when you press the reset or restart or replay button, you will do this:
Get change attribute behaviour and then do this:
Game.Score To 0
(with that, you can do the same for your lives and everything that has numbers as a score or something).
Example 2:
if you wanted to change the actors or any other item on the screen to its default position, you will do this:
Get change attribute behaviour and do this:
Game.DefaultPosition To True
Example 3:
you can do the same as you did for example 2 for the gameover part however, instead of true, change it to false.
So at the bottom of the all these 3 or more attributes depending on how many you have, you should add a change scene attribute at the end to what scene you wanna go to, so lets say to the beginning of the game. Then you will see everything will be set to its default value life when you first started the game.
P.S: I chose to share this information because I've come across a lot of people facing the same problem as me, so I thought I should help out and save people time. I spend hours on this and finally I managed to find out how after doing a lot of research and having some patience. I hope this makes sense. I was hoping I could add a picture to this so it would make you understand it more but I don't know how to attach an image. Until then, you can message me and I will privately send you an image of what I just explained. Thanks.