How do I

0 favourites
  • 5 posts
  • Hi,

    I've been stuck on this for over a week any help would be soooo welcome!

    I have a 'menu page' which shows the levels, only level 1 is unlocked at the start.

    When the player wins level 1, I set 'lvl2 unlocked and make the lvl2 button visible' this is perfect as the player can now select level 2.

    But because on level 1 I have added "reset global variables" (I have to do this as that level takes turns between the player and computer) it resets the global and if the player plays level 1 again (even if they have completed it) the global gets reset and if they die or use the 'menu page button' the lvl2 button is invisible again.

    I've tried sooo many different ways from saving to local variables, really what I need is a way to do this on the menu page:

    If lvl2 button visible then permanently change global to 1 from 0, then when the player goes back to lvl and all global are reset, the global that I want is reset to 1, which keeps the lvl2 button visible.

    I thought 'set global' would have set it permanently?

    Is this possible or is there another way that I'm missing?

    Thank you.

  • Hi,

    I've been stuck on this for over a week any help would be soooo welcome!

    I have a 'menu page' which shows the levels, only level 1 is unlocked at the start.

    When the player wins level 1, I set 'lvl2 unlocked and make the lvl2 button visible' this is perfect as the player can now select level 2.

    But because on level 1 I have added "reset global variables" (I have to do this as that level takes turns between the player and computer) it resets the global and if the player plays level 1 again (even if they have completed it) the global gets reset and if they die or use the 'menu page button' the lvl2 button is invisible again.

    I've tried sooo many different ways from saving to local variables, really what I need is a way to do this on the menu page:

    If lvl2 button visible then permanently change global to 1 from 0, then when the player goes back to lvl and all global are reset, the global that I want is reset to 1, which keeps the lvl2 button visible.

    I thought 'set global' would have set it permanently?

    Is this possible or is there another way that I'm missing?

    Thank you.

    If you use "reset global variables" it does exactly that and will reset all of them to their default values. What you can do instead if you rely on these global variables for switching between player and computer turn, is to make a "Sprite controller". Basically this is just a normal sprite that you add to your project, make it something like 16x16 pixel so it doesn't use any resources and you could name it something like "Level controller" so you know what it is.

    The only purpose of this sprite is to hold variables. So you simply add whatever you need to it that is related to switching and keeping track of levels. You then turn it into a global object in the "Properties" menu and that way you will have access to it through out all your layouts.

    "Reset global variables" doesn't reset these variables.

  • Well knock me down with a feather! it worked! Thank you so much nimos100

    I was worried to post on here, (I seem to ask a lot of dumb questions) and was also worried there wasn't a way to do it.

    But that's such a cool way I didn't know that could be done.

    Me and my game thank you

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well knock me down with a feather! it worked! Thank you so much nimos100

    I was worried to post on here, (I seem to ask a lot of dumb questions) and was also worried there wasn't a way to do it.

    But that's such a cool way I didn't know that could be done.

    Me and my game thank you

    Don't ever be afraid to ask questions - that's how we all learn

  • MarkThomas

    https://www.dropbox.com/sh/eioscti86bpr ... 7YPza?dl=0

    here find file called Select Level capx file

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)