Reset scene problem

ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
edited November -1 in Working with GS (Mac)
I have a scene problem...

I have a main menu - works fine
after you press the 'Press Start' text, the game goto to another scene called 'TALK' (this will eventually have a comic picture in it.
Next after that it goes to SCENE 1(The main game)

Now when I play SCENE 1 and my energy gets to zero i have an attribute (Boolean) called 'GAMEOVER', so I have it that when the energy bar gets to zero - change attribute GAMEOVER to TRUE.

NOTE - I also have a score that stats at zero and ranks up as you play - works

Now on all my gfx in the game i have a rule to turn all the gfx to the colour red when the GAME OVER attribute is TRUE- works great.

Then I have a big gfx called 'Game Over' which is a graphic of some text saying Game Over...this then fade in at the middle.

My score which I have won then scrolls upwards underneath the Game Over Graphic - all works great.

Now I have a timer that starts as soon as the Game Over graphic fades in...after 5 seconds - change scene to 'Main Menu. - This works great too, until this next big

The MAIN MENU starts again - goto scene 'TALK', after 5 second timer finishes it then loads 'SCENE 1' again.

I would expect to see a new fresh SCENE 1 but all I get is the screen that I saw at the end of the old game...I.E...the game screen with all the graphics red and my old score?

What am I doing wrong...been banging my head against a wall for 3 hours trying everything...

I have put a reset scene in but that just resets the scene constantly with a clicking noise...

The problem is though I need the score from the first game to use in my hi score table ...

Someone please help!!!

Thanks guys

It takes a Zombie to know a Zombie!!!

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Hey,

    Trying to remember my stuff, you need to change everything back to what is was before you added the color. If i understand correctly, all your actors are red when you go to scene 1. So, you need to change it back to what it was originally.

    As i am not able to access GS at this moment, this is what i can say:

    Right before you switch scenes, change everything back to the way it was, this will need to be in a rule i believe.

    OR! You could just make new graphics that ARE red. So when game is over, change image to red color gfx. Otherwise the nice gfx.

    Hope this helps, its all i can do without GS in front of me.
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Hi Braydon,

    Its not the colour thing...the whole scene re-starts when the score scrolls up under my 'GAME OVER' screen and then after 5 seconds goes back to the MAIN MENU (Like it should)

    I then press 'PRESS START' to hopefully go back into a fresh new 'SCENE 1' but it keeps on going back to the graphics all red, GAME OVER gfx on screen and the score I achieved scrolling up underneath - 5 seconds pass and it starts all over again.

    When it's GAME OVER I would have though changing the scene to the MAIN MENU would automatically reset the scene data but it doesn't...it gets stuck in the loop

    Any ideas?

    It takes a Zombie to know a Zombie!!!

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Send me an email with some pix. I can't visualize this..Sorry
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Have sent you an email dude...don't think it will help much though

    It takes a Zombie to know a Zombie!!!

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    is it alright to have the GAME OVER attribute as a boolean?

    whats the difference between an integer and a boolean.

    This problem is driving me nuts.

    I would have thought changes scenes would reset them automatically?

    It takes a Zombie to know a Zombie!!!

  • MPCavMPCav Member, BASIC Posts: 81
    a boolean has only 2 states, true and false, or 1 and 0. It's effectively an on/off switch. An integer stores a whole number (so 1, 2, 3, 4, 5...) and a float can store non integers, e.g. 1.24, 4.21, 556.34, etc.

    GS does not automatically reset variables, as that would mean the game would 'forget' everything between each scene.
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Thanks MP for clearing that up for me.

    I'll just have to keep on asking people what they think is going on with my game...

    I just don't understand whey restarting a scene after you have just been in it means seeing the last part of the scene you were just in?

    It takes a Zombie to know a Zombie!!!

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    MPCav said:

    GS does not automatically reset variables, as that would mean the game would 'forget' everything between each scene.

    Hi again ZB, to clarify what MPCav wrote, if your attributes are scene ones, then they are "forgotten" when you change scene and revert back to their original values; however, game attributes are remembered (to what they might change to) from scene to scene.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Ah I see, I think.

    I think it might be something to do with the health attributes when it loads again, the health bar is zero, all the screen is red, as my 'Game over' attribute is set to do and the score is still the score I won when I played the scene last..

    I think it's that but can't be sure..,losing the will to live now.

    Was flying along with my app but now hit this giant wall

    It takes a Zombie to know a Zombie!!!

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    I have checked my attributes and they are set as 'GAME' attributes.

    Does that mean i should have set these attributes within the SCENE attributes?

    I think the GAME OVER attribute would have been advisable to have within the GAME attributes..think i've done that correctly as I would need the score to carry across to other scenes and the high score table.

    It takes a Zombie to know a Zombie!!!

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    I don't understand what's going on. I have to other apps that happily move from scene to scene and play perfectly but this new app, every time I play scene 1 after initially playing it, it starts at the point it ended..i.e game over and the score I reached...

    I just don't get why its doing this...

    Can anyone help me?

    It takes a Zombie to know a Zombie!!!

  • CatGoneCrazyCatGoneCrazy Member, PRO Posts: 90
    Is it as simple as setting up a rule somewhere in your title screen to turn your global boolean GameOver attribute to 'false'? Otherwise it will immediately be Game Over as soon as you start any game after the first one. I might have completely missed the point here though...
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Ah, I will try that CGC and let you know...

    Thanks for the tip.

    It takes a Zombie to know a Zombie!!!

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Hiya CatGoneCrazy

    You were absolutely correct! I just can't believe it was that easy.

    All I have done is do a change attribute for the health bar, score and Game Over boolean and on my splash screen (which appears before going into scene 1) the game now works a treat.

    I can now go back and carry on!

    Your a star!!!

    It takes a Zombie to know a Zombie!!!

Sign In or Register to comment.