Scene doesn't reset properly on second scene
dmaywood821
Member, BASIC Posts: 11
I'm just starting out and I'm making an endless runner based off one of the tutorials here. I made a second level and when I tested it out, the scene doesn't reset like the first one. I have a rule that if the player collides with either one of two other actors then it is destroyed and the scene resets. It works great on the first level. But in the second, when the player falls into my "toxic slime" or hits an enemy it just locks up where it is. I keep looking at my rules and they say the same thing, but I'm guessing I'm missing a concept here.
Comments
//
Can you show a screenshot of your rules?
Mental Donkey Games
Website - Facebook - Twitter
I'm guessing you have an artibute that doesn't reset during scene changes. Very frustrating but impossible to diagnose without seeing the rules.
So what do you want when player hits slime?
Look at rules in slime and player. Follow the rules.
Game level attributes do not reset when you use scene reset. You will need to return any game level attributes to their default condition before you reset the scene.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Here is a screen shot of the rule for making the scene reset.
I'm a little lost by this. What do you mean?
... Also I just realized I am in the working with GS Mac. I could have sworn I clicked on on working with PC. That's weird...
Changed it to 'Working with GS (PC)'
Oh, thanks! I didn't realize you could do that.
Here's an example: let's say you create an integer attribute called game.lives and set it to 3. And then you play the game and lose a life. When you start again from the menu scene, game.lives will be 2 instead of 3. So you would need something like this in one of your buttons:
If Touch is Pressed
Change Attribute game.lives to 3
Change Scene [gameplay]
And you'd need to include every game attribute you want to reset before you change the scene. An alternative, if you have lots of game attributes that need resetting, is to use a table. It's then possible to copy the table before the gameplay starts and copy back the master data to reset everything. Using a table, it's a single behavior instead of a whole bunch of them.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Ok, so I've got that for my score, it resets right. I'm not sure how to get my player back to the starting position at the beginning of the scene though. Once it is destroyed, the score resets but the camera is stuck in that spot and the actor is just gone.
Use a reset scene behavior.
So
Rule
When player is dead or whatever triggers game over.
Change attribute game.score to 0
Add any other game.whatever that need to be change back to original setting
Timer with run to completion checked
After .3 seconds
Reset scene
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Yea, I've got a reset scene behavior in my rule for whenever my player collides with either of the other two actors I have designated.
Ok, timer didn't work... but I figured it out. I don't actually completely understand why this works though.
What I realized was I had a rule under the coins actor that if the score was = to 12, then it would send you to the next scene. I moved that rule under the actor player and added the condition that the player also had to be at a position at the very end of the scene. I thought maybe it was locking up about trying to change to the next scene, but there isn't one. I still don't completely get what was happening, but it's fixed now!
Thanks for all your help!