Global Game Variables - How to change level by level

micksolomicksolo Member Posts: 264
edited November -1 in Working with GS (Mac)
Hi,

so basically I have a level, a main player and some enemies. I want to use the same level layout, but increase the speeds of the main player and enemies. However if I copy and paste the level, and then change the speeds, it does it across all levels. Is there a way to make it so that the variables can be changed across levels?

Comments

  • TwistedMechTwistedMech Member Posts: 408
    The simple way to do this is have an actor called SetLevel.

    For the first level you set a load of game.xxxx = value so that when the level starts, this actor sets the global values. Place this actor on the screen in level 1.

    Now, when you copy/paste your level to make level 2, open the actor called SetLevel in level 2 (find in on the level and the left mouse double click) and not the one from the actors panel. Click on the padlock to make a new instance of the actor and set the new values.

    The SetLevel actor in the actors panel on the left is defined for level 1 only and as you have a new one for level 2 which you access from the level only, when you copy/paste to level 3, just make sure you edit the actor in scene.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi micksolo, one way which should work well would be to first create an empty actor.

    In it's Rules, put all of your change attributes to change your variables.

    For every scene where needed, drag this to the screen and place it so it's hidden outside of the screen viewing area.

    For each of these, click the lock in the rules to make them instances, then amend the variable values for the particular level.

    Then you'll have the attributes updating each time you enter a new level.

    :-)

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

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    If its literally the same level layout, in all your spawners etc you could do something like this;

    If attribute game.level < 5
    Spawn enemy every 30 seconds

    Then in the otherwise

    New Rule

    All
    If attribute game.level > 4
    If attribute game.level < 10

    Spawn enemy every 20 seconds

    Etc etc

    All you then need to do is track what level the player is on with 1 attribute called something like game.level
Sign In or Register to comment.