How to do "HARD RESET" for my game tests?

  • Hey All,

    I have this creature which is on "SLEEP" state, and once the TIME of the game = X seconds the creature will change state to "AWAKE" and then "FLY" and do it's state machine actions...

    Usually I test the game on normal Run / Preview and when I ran into issues I use the Debug Mode.

    When I test the game (without debug mode) I made "F5" key to Restart the Layout. it won't RESET the time of the game, so my creature will SLEEP forever now...

    But when testing in Debug Mode, using the RESTART button, it will actual reset the time of the game and EVERYTHING WORKS GREAT!

    MY QUESTION:

    How can I reset the layout AND THE TIME of the game using the same "F5" key? (without debug mode)

    I tried to look for Reset Game or Restart App or something, but didn't find... am I missing something?

    I have a feeling that I'm missing a very basic option, please guide me. :)

    Thanks ahead!

  • As a hot fix, rather than doing "once the TIME of the game = X seconds", you could get the time when the frame starts and go by that instead like -

    on start of layout, set creatures variable "myStartTime" to current game time + X seconds.

    If create "Sleep"

    and creatures "myStartTime" is <= current game time, set state to "Awake"

  • Thanks for your advice mOOnpunk I appreciate it but to be honest it's more confusing to me.

    Also, I don't want to mess with the animation / frames since my state-machine are based on these already and it will make a hard time for me to follow.

    Isn't there a simple action that Replicate what the 'Restart' button on the Debug mode does?

    it seems like it resets the all game / application including the TIME.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I dont know about resetting the whole game time and all that but...

    Why dont you just use a normal timer behavior on the character

    on start layout "set timer" (2 seconds or whatever) > then "on timer" (=0) = dude fly

    or if you need timer variable that increases in real-time then just make a variable and add dt to it every tick. (it should be easy to change your animation events to reference this instead of game time.)

    both these things will always reset when restart layout.

  • Thanks for your advice and example NetOne, it sounds like a good solution!

    I'm not sure why, but it's not working for me...

    here is what I tried, the enemy keep sleeping, never awakes:

    * I also tried without "Is Timer.." just to see if that was the issue, but I get the same result.

    I don't want to mess with my State-Machine for this creatures as it's very complex already, that's why I just wanted a simple TIME RESTART.

    Can you tell me what I do wrong, so I'll try to fix it and make it work with a Timer?

    Thanks ahead!

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