need urgent help! plz

Mcreator83Mcreator83 Member Posts: 120
edited November -1 in Working with GS (Mac)
hey guys so I am having trouble with the levels. I play the first level and when i lose it goes to the game over screen as planed but when i want to play the same level again after i hit "play again" and go to the level menu and chose the level it goes to it but it instantly goes to the game over screen. the thing is it is remembering what happened before and not reseting itself. now how do i reset the level once i win or lose and want to play it again?

this problem just came from no ware and i tried for hoers to fix it but nothing is working... :(

so anyone?

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    you need to manually reset all attributes you are tracking when you hit play again. set everything back to zero, or whatever it is you're looking for to end the level.
  • Mcreator83Mcreator83 Member Posts: 120
    wouldn't that reset the levels that are unlocked to locked again? do you have en example?

    so how do i reset the attributes? never done that before.

    my head is all bombarded after all the things I tried. the funny thing is it might be a really easy thing to do lol :P
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    first of all, how do you decide when you lose
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Leave the attribute that tells that the levels passed the way it it.
    And just like jonmulcahy said you at the end when you beat the level where the behavior is to switch scenes, have chang attribute behaviors for every attribute except the one that tells that the levels clear and any thing else you want to stay the same. Change them all back to what they are at the begining of game
  • Mcreator83Mcreator83 Member Posts: 120
    when lives are at 0
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    for example, in one of my first games the player had 5 lives. when his lives reached zero, the level ended. when i hit the button to restart the level, i also had to reset his lives back to 5 with a simple change attribute rule on the button press, otherwise the level would just end again.

    in my more recent games im doing basically the same thing, but having to reset many variables for different actions insntead of just health.
  • Mcreator83Mcreator83 Member Posts: 120
    ah ok then i will try that and see what happens, thanks for your answers guys!
  • Mcreator83Mcreator83 Member Posts: 120
    ok so i tried that and it worked. and then it crashed lol restarting my mac now

    I had it like this:

    on touch

    game.Lives = 0

    change attribute

    game.Lives to game.Lives+5

    so i have to do this for every live there is like if it is 4 lives left i need to ad one live and if 3 i need to add 2 and so on?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    no dont add five, just change to the number five so no matter how many are left it resets to 5
  • Mcreator83Mcreator83 Member Posts: 120
    ah ok thanks :)
  • Mcreator83Mcreator83 Member Posts: 120
    thanks a lot guys it is working well now :D
Sign In or Register to comment.