Back to layout after approx. 30 seconds

This forum is currently in read-only mode.
From the Asset Store
30 Fantasy Monsters
$4 USD
50% off
30 high-quality 2D monsters. This asset is perfect for a side scrolling game, or even a turn based RPG type game.
  • Hiya,

    For one of my end projects I persuaded my teacher so that I can now create an awesome game in Construct Classic (it will take me too long to learn Construct 2, that's why).

    I'll be presenting my game in an art museum and I was having some difficulties on how to make sure every visitor gets the same playing experience. I know people are lazy, so I wanted to make sure that after approximately 30 seconds the game automatically jumps back to the title screen, another layout. Otherwise I can guess what will happen: people leave it in the middle of the short game and the next visitor has no idea what to do. Is this possible to do in Construct? :)

    Thanks in advance,

    M. vd Laar

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Of course, it is possible :)

    Combine the system condition 'compare time' with the system action 'go to layout'. The timer will be compared to a millisecond value (1000ms = 1s). You should also give your layout a name (in this example "titlescreen") and then use that name in the 'go to layout' action.

    + System: Timer is Greater or equal 30000

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

  • MvdLaar,

    maybe this is obvious, but, you'll probably want the time to restart with each input, no? So, in addition to Tulamide's events:

    +Every 1ms: Add 1ms to "timer"

    ->On Any Key Pressed: Set Timer to 0

    This way, the player isn't interrupted and reset in the middle of the game, but once they stop playing, the counter won't be reset and will trigger the "go to "titlescreen" action.

  • MvdLaar,

    maybe this is obvious, but, you'll probably want the time to restart with each input, no? So, in addition to Tulamide's events:

    +Every 1ms: Add 1ms to "timer"

    ->On Any Key Pressed: Set Timer to 0

    This way, the player isn't interrupted and reset in the middle of the game, but once they stop playing, the counter won't be reset and will trigger the "go to "titlescreen" action.

    I know what you're aiming for, and it is a good idea, but that code won't work. Timer is a system expression and you can't go faster than the current frame rate with "every x milliseconds" (and I doubt the game will run with solid 1000 fps all of the time) and key pressed is a trigger, not an action.

    But you can do it by adding a global variable ("currenttime")

    + System: Always (every tick)

    -> System: Add TimeDelta to global variable 'currenttime'

    + MouseKeyboard: On any key pressed

    -> System: Set global variable 'currenttime' to 0

    + System: Is global variable 'currenttime' Greater or equal 30

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

    Note that you have to compare 'currenttime' to seconds, not milliseconds, if you want to use this method.

  • Thank you for your replies! Great explanations.

    But, and I am truly sorry for this, I seem to have forgotten a major detail in my wishes in the first post: I actually meant that the game should automatically go to the layout after 30 seconds of complete silence;

    In other words: I need to make something that makes sure that when there hasn't been touched a single button for 30 seconds, it goes to the layout 'titlescreen'.

    I believe both your theories work and can be of practical use in this situation, only I need to add the fact that no button is touched whatsoever for 30 seconds.

    I figured I could use a combination between tulamide's way and the_chosen_bite's way to do this, right? Like, every tick the system adds some milliseconds to the global variable timer (the amount depending on the fps) and when any button is touched, it sets the timer to 0. Only when for 20 seconds no button has been touched, it will automatically go to the titlescreen, right?

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