Touch events while game is suspended

  • Hi there,

    I'm not sure if this is a bug. If not, maybe you can see it as a suggestion for a next update ;)

    I found out that the game (runtime) while suspended doesn't ignore player inputs, for example a tap gesture. You tap in the suspended game and the actions of this condition will be executed after the suspension finishes.

    It would be very great if any interactions with a suspended game would be ignored.

    I use setSuspended(true) while showing ads (game pauses and mutes). I don't know why but if the player skips an ad this touch event goes "through" the ad overlay right to the game. So if for example a sprite is placed under this "skip" area of the ad its actions will be executed after the ad closes although the game had been suspended in the first place.

    As a workaround I created a "isAdShowing" condition in my addon and use it (inverted) combined with all used touch conditions in my project, but this doesn't seem very elegant.

    It is possible to avoid this behavior of the runtime in the first place or what i can do to solve this issue in a better way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The runtime is suspended when it goes in to the background, is hidden, or otherwise becomes inaccessible. For example, switching back to the home screen on mobile, or minimizing the browser window. In these circumstances there is no opportunity for input events.

    It sounds like the problem is you are suspending the runtime when there is still the opportunity for input events. The solution is to either remove the opportunity for input events to reach the runtime, or don't suspend the runtime.

  • Thanks for your fast answer!

    Yes, i know that suspending the runtime while showing ads is a little bit "misused" and not the intended use case.

    "The solution is to either remove the opportunity for input events to reach the runtime, or don't suspend the runtime."

    Not suspending the runtime is no option, cause i need to pause AND mute the game. If there is alternative way I'm glad to hear it :)

    How i can remove the opportunity for input events to reach the runtime? Is there a runtime function to manage this? To switch it on and off? This would help me a lot!

    Thanks :)

  • How i can remove the opportunity for input events to reach the runtime?

    I don't know, it sounds like a bug in whatever ad library you're using.

    Nothing else anywhere in the runtime on any platform requires this, so there's no runtime support for working around it. If the runtime isn't visible it shouldn't receive input events, period - if something is letting input events through it's a bug with that thing.

  • It seems you have to add vars to touch triggers, so events won't trigger when touch goes though game in that position. Touch Triggers do trigger even when time scale is 0. you also could set that touch trigger group disabled.

    But soon you have button that user can hold down, you can't modifie them by vars. So vote my cool stuff here: construct3.ideas.aha.io/ideas/C3-I-586

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