help for level count

FViMaginationFViMagination Member Posts: 89
edited April 2012 in Working with GS (Mac)
Hi everybody,
I'm almost done with a new game that has several levels, and i'm ok with unlock levels from the lock icon to Level number while going on with levels. I've followed the cookbook templates about levels made by T-shirtBooth, but now I can't figure out how to keep records of levels. that's because I put a Change Attribute behavior into an Actor of every Scene that sets its own Level Number (example, while you're playing Level 3, that Actor sets game.LevelNr to 3, and so on). The problem is that if I am playing Level 14 (as an example) and I go back playing Level 1, game.LevelNr is being set to 1, and I won't be able to play any other level besides Level 1, because all the other levels will be Locked...
Hope my explanation is clear, I don't know what function I may apply to my game to keep records of Level numbers and be free to play any previous level without losing the new ones I just played.
thanks in advance for your help!

Best Answers

  • simo103simo103 Posts: 1,331
    Accepted Answer
    @francyfranchini ... you will need to put an extra rule in each level ... if Game.LevelNr is < the level number then change game.LevelNr to 1 or 2 etc
  • MotherHooseMotherHoose Posts: 2,456
    edited May 2012 Accepted Answer
    conflict/problem is in using the game.LevelNr to store two different states of gamePlay:
    … levelUnlocked and currentLevel

    need two gameAttributes to store those separate values

    gameAttribute: index type … LevelNr (currentLevel)
    gameAttribute: index type … unlockLevel (last/highest level unlocked)

    on your controlActor: (name them with number of level … 1; 2; 3; etc.)
    changeAttribute: game.LevelNr to self.name

    when level is completed:
    Rule: when
    Attribute: game.unlockLevel = game.LevelNr
    -changeAttribute: game.unlockLevel To: game.unlockLevel+1

    image MH
  • MotherHooseMotherHoose Posts: 2,456
    Accepted Answer
    sorry … @francyfranchini

    for when level is completed … rule in above should be
    Rule: when
    Attribute: game.unlockLevel = game.LevelNr
    --changeAttribute: game.unlockLevel To: game.unlockLevel+1

    so a level only unlocks when the player completes the current LevelNr

    image MH

Answers

  • FViMaginationFViMagination Member Posts: 89
    @francyfranchini ... you will need to put an extra rule in each level ... if Game.LevelNr is < the level number then change game.LevelNr to 1 or 2 etc
    I've tried it, but it doesn't work... so maybe I made a mistake.
    There an Actor into every scene that has a Change Attribute "game.LevelNr to 1, or 2 or 3", etc, it obviously depends by the level the Actor is in. This Actor shows the level number you're at. Then I put that Rule you told me into that Actor, but if I got back to Level 1 from level 3 or above and then i go to the Main Menu, this one shows me Level 1 unlocked and all the other levels locked again. This Main Menu is like T-ShirtBooth's Zombie Drop level menu, just to explain what I'm talking about.
    Where am I wrong? :)
  • FViMaginationFViMagination Member Posts: 89
    conflict/problem is in using the game.LevelNr to store two different states of gamePlay:
    … levelUnlocked and currentLevel

    need two gameAttributes to store those separate values

    gameAttribute: index type … LevelNr (currentLevel)
    gameAttribute: index type … unlockLevel (last/highest level unlocked)

    on your controlActor: (name them with number of level … 1; 2; 3; etc.)
    changeAttribute: game.LevelNr to self.name

    when level is completed:
    Rule: when
    Attribute: game.unlockLevel = game.LevelNr
    -changeAttribute: game.LevelNr To: game.LevelNr+1

    image MH
    thanks, MH!
    and how do I change "unlockLevel" value too?
  • FViMaginationFViMagination Member Posts: 89
    thank you very much, MH!
Sign In or Register to comment.