Question about pausing game

  • I want the game to remain paused for ONLY 3 seconds, then I want it to resume itself. But it is not working:

    Try 1:

    System: Set Time Scale = 0

    System: Wait 3 seconds

    System: Set Time Scale = 1

    Doesn't work

    Try 2:

    Variable Count = 0;

    System: Set Time Scale = 0

    System: Every 1 second, add 1 to variable count.

    Is count = 3? If yes then Set Time Scale = 1

    Doesn't work.

    It looks like when "time scale = 0" everything stops working, even the "in every X sec" action stops working. Is there a workaround for this?

  • Try this:

    Create a Global variable called IsPaused

    Create a Global variable called Timer

    Create a family FamilyObjects

    Put all objects you want paused into FamilyObjects

    Timer=0

    System > Timer (Is Greater than 0) > System > Set IsPaused to 0

    System > Timer (is less than or = 0)>System > Set IsPaused to 1

    System > IsPaused =0 > Set FamilyObject Time Scale = 1

    System > IsPaused =1 > Set FamilyObject Time Scale = 0

    -----(sub event---)------- > System > every 1 Second > System -1 > From Timer

    On some Condition > System > Set Value Timer to 3

    It actually may work without the Family and just trying it setting the System timescale to 0 and 1, if not, setting the time scale of the objects to 0 should do it.

  • Try this:

    Create a Global variable called IsPaused

    Create a Global variable called Timer

    Create a family FamilyObjects

    Put all objects you want paused into FamilyObjects

    Timer=0

    System > Timer (Is Greater than 0) > System > Set IsPaused to 0

    System > Timer (is less than or = 0)>System > Set IsPaused to 1

    System > IsPaused =0 > Set FamilyObject Time Scale = 1

    System > IsPaused =1 > Set FamilyObject Time Scale = 0

    -----(sub event---)------- > System > every 1 Second > System -1 > From Timer

    On some Condition > System > Set Value Timer to 3

    It actually may work without the Family and just trying it setting the System timescale to 0 and 1, if not, setting the time scale of the objects to 0 should do it.

    @TheDom thanks for helping. The problem is that this game is an endless runner and it contains a lot of "Every tick do this" functions for example: Every tick: Move platform, every tick increment DistanceRan. As far as I know, you cannot add an event to a family; you can only add objects. I want the "Every tick" function and other game events to stop for 3 secs. Is this possible?

  • Add "IsPaused to 0" as a 2nd condition to the "every tick" conditions. The events can only fire every tick if the game is not paused.

  • Add "IsPaused to 0" as a 2nd condition to the "every tick" conditions. The events can only fire every tick if the game is not paused.

    @TheDom

    Thanks,

    When trying to move objects that I want to be paused to FamilyObjects, it says you can only add objects of the same plugin to familyobjects. What should I do?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Setting the timescale also affects the 'Wait' action.

    Instead try making a measurement based on the wallclocktime expression, which is not affected by the time scale.

  • > Add "IsPaused to 0" as a 2nd condition to the "every tick" conditions. The events can only fire every tick if the game is not paused.

    >

    TheDom

    Thanks,

    When trying to move objects that I want to be paused to FamilyObjects, it says you can only add objects of the same plugin to familyobjects. What should I do?

    Just create more Families for the other plugin types and then add them in the same events as FamilyObjects

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