0 Favourites

R to Reset Not Reset Everything

This forum is currently in read-only mode.
  • I have found that when resetting the game:

    <code snippet>

    + MouseKeyboard: On key R pressed

    -> System: Go to layout 1 with transition "None" lasting 0 MS

    It does not always reset everything. Like when a boss ship comes:

    <code snippet>

    + System: Is global variable 'Score' Greater or equal 5000

    -> System: Set global variable 'Mode' to 1

    + System: Is global variable 'Mode' Equal to 1

    + System: Every 2000 milliseconds

    -> BossMovePoint: Set position to Hero.X+random(20)-10, 100

    -> Boss001: Set speed : 50 towards BossMovePoint

    Or when this item gets updated in the top GUI:

    <code snippet>

    + Hero: On collision between Hero and PurpleCross

    -> System: Add 1 to global variable 'JesusScore'

    -> PurpleCross: Destroy

    + System: Is global variable 'JesusScore' Equal to 1

    -> JESUS: Set animation frame to 2

    ...and so on to frame 6.

    Any thoughts about this?

    Thank you.

  • Going to a layout isn't supposed to reset global variables.

    If you want to reset global variables, you have to do it in some function that you'll call from that event. The event will take to the next (or same) layout, and the function will set the global variables values to the value you want them to have (in this case their default value).

    By the way, it doesn't reset the values of private variables of global objects either. So you have to set them manually too.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • So, call to an EVENT, say in "start of layout" opposed to starting the layer itself?

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