Replay a completed level?

gilamonstergilamonster Member Posts: 31
edited November -1 in Working with GS (Mac)
I have a select level page with no levels locked. Once each level is complete I would like for the level to be able to played again. On the levels page each level is an image in which I has set up a rule set so that when

game.level1=game.level complete
Change image to an image with a check mark to indicate that level has been completed.

But when this image is clicked on again the level will not play again it goes to the page but displays the level complete graphic that happens when the level is completed and doesn't allow the level to be played again.

I am new so I know I am missing something, any help on how I can fix this would be great!

thanks

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    you need to manually change every attribute back to there starting point when you switch scenes, but keep the level completed attribute the same. THat way the check stays there that you completed it, but the level will still restart and be playable when you go back and select it.
  • gilamonstergilamonster Member Posts: 31
    Thanks JohnPapiomitis. Can you explain the changing every attribute back to their starting point? I am not sure what you mean.

    I don't need to use the Reset Scene behavior for this?
  • gilamonstergilamonster Member Posts: 31
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    use another attirubte to display the level complete graphic, so you can keep level complete=1 the same and have it show it unlocked. Whats happening is because you display the graphic when level complete=1 it always goes to the level complete scene. So you can make a attribute for each level like leveldone then when level done =1 change attirubte level complete to 1. That way when that attribute is 1 and says you beat the game and unlocks the level. Then at the begining of the scene or when you switch back to play again , change attribute level done to 0 and any lives, enemys and ect attributes back to how they are at the begining of the game. that way it will know its unlocked and keep it that way, but you can play it again from the beginign without it effecting the level being unlocked and the unlocked image.

    Hope that makes sencse im falling asleep over here lol
  • gilamonstergilamonster Member Posts: 31
    Thanks, I am going to read through your reply and see if i can get it to work. I am new to all this so I may have more questions later. I appreciate you staying up to answer my question.
  • gilamonstergilamonster Member Posts: 31
    can you explain how to use an attribute to display the level complete graphic? thanks.
  • joey2ejoey2e Member Posts: 99
    Im no expert, however this is how I would do it:

    Firstly set up the following attributes:

    TYPE - NAME

    Boolean - LevelOneComplete
    Boolean - LevelOneUnlocked
    Integer - LevelOneScore

    In the first level scene do the following:

    For example we say the level is complete when you get 1000 points

    In the actor which displays points add the following rules:
    RULE - When LevelOneScore = 1000 (When the score is 1000)
    Change attribute LevelOneUnlocked to true (Change that attribute to 1000)
    Save Attribute LevelOneUnlocked (Important to save otherwise wont work when you restart the game)
    Spawn actor - Level 1 complete graphic (This will spawn your level complete graphic)

    In the level select scene add the following to the actor for the first scene
    RULE - When LevelOneUnlocked = true
    Change image to check

    SECOND RULE - When touch is pressed and LevelOneUnlocked is true
    Change scene to level 1

    Hope that helps
  • gilamonstergilamonster Member Posts: 31
    Okay, I know this is probably a basic question but when you say level complete = 1 does the 1 mean true or does it mean 1 level complete and when the second level is complete it would change to 2 indicating how many levels have been completed?

    Would using game.stage1 = game.level done
    game.stage2 = game.level done

    be another way to do it?
  • gilamonstergilamonster Member Posts: 31
    Thanks joey, I will try your suggestion. For the Save Attribute what would the key be?
  • joey2ejoey2e Member Posts: 99
    There are different types of attributes as I showed above,

    For Booleans there is only two possible ways it could be, which is true or false

    For integers you can put practically any number you want in there.

    Play around with what I put above, there are numerous different ways to achieve what you are looking to achieve and im sure there are a few ways much better that ive shown you.

    Its always best to play around with it so you fully understand it, keep at it it wont take long before you get it.

    Joe
  • joey2ejoey2e Member Posts: 99
    For the save attribute the key is completely up to you what you put in there, however so its easy to remember later do something which makes sense to you.

    For example:

    Save attribute -
    NAME OF ATTRIBUTE KEY
    LevelOneUnlocked - Level1

    Then when you load just do the same, i.e

    NAME OF ATTRIBUTE KEY
    LevelOneUnlocked - Level1

    Load the attribute at the start screen
  • gilamonstergilamonster Member Posts: 31
    in your example I don't see where to use the LevelOneComplete , I see the LevelOneUnlocked is used twice.
  • joey2ejoey2e Member Posts: 99
    Ahh my bad you don't need the LevelOneComplete attribute
  • gilamonstergilamonster Member Posts: 31
    on this part:

    Change attribute LevelOneUnlocked to true (Change that attribute to 1000)

    Are you saying that in the box where true is - change it to 1000?
Sign In or Register to comment.