Pause/Resume Buttons

When I open my packaged HTML5 game in a browser, it begins “Paused” and to play I have to click “Resume.” Is there either a way to make the game not paused on startup, or is there a way to indicate in-game that the game is paused?

I tried making a simple menu for when it is paused, which works when I use an input (such as “P”) to “Set Game Paused” but clicking the buttons at the bottom of the game seems to be considered a different type of pause, so my pause menu does not show up.

Also, is there a way to remove the “Fullscreen” “Pause” “Resume” and “ClearStoredData” buttons from the bottom of the game? Thanks for any help!

Hey ,

Do you have a public link to your game which can be viewed? Do you have UMG or any blueprints set up that will cause your game to pause on start up? If so, I would suggest uploading screenshots so we can see how you’ve configured your project.

I’ve posted my game to a website here: Play Summate, a free online game on Kongregate

(If that link isn’t allowed here, I can remove it and private message it to you)

Please give it a moment to load. The issue is that I can click on the UMG buttons, but I cannot use the keyboard to move my character until I click “Resume.” Then a similar problem occurs when you click somewhere else on the page, then click back on the game – the only way to move the character is to click “Resume.”

I haven’t implemented anything in UMG or elsewhere that would cause my game to pause. I’ve tried forcing the game to focus on viewport whenever the game is clicked on, but that doesn’t seem to solve this issue.

Is there a way around this? And is there a way to remove those buttons from the bottom of my game? (Since I don’t really have any use for them)

Also, slightly off-topic from the title – but do you know why the loading process is so slow for such a basic game? There isn’t much to it, but the initial loading takes a fairly long amount of time.

Thanks!

Hey ,

Thanks for providing me with the link. I have launched it on Chrome and I have been able to successfully play the game without any trouble. I did not notice a long loading time however, if there is a long loading time it’s typically due to your computer memory, your browser used and of course, your internet speed. If you have slow downloading bandwidth, it will take longer to load. When the game first loads up, it says “PLAY” which I then click on and the game begins. There is not a pause screen between each level in the game. I’ve also been able to move my box around. You must make sure that ‘resume’ is selected for your game to recognize that you’re able to move the box around. I’ve gotten all the way to the ‘number 16’ level where it doesn’t move to another level.

I’ve looked over our HTML5 example game ‘Tappy Chicken’ and I do not see those buttons listed. Therefore, there is a way to take them out. Since the game is HTML5 basically, you simply would need to open up the .html file and modify it the way that you’d like it to be.

" <div class=“emscripten”>
<input type=“button” value=“Fullscreen” id=“fullscreen_request”>
<input type=“button” value=“Pause” onclick=“Module’pauseMainLoop’]();”>
<input type=“button” value=“Resume” onclick=“Module’resumeMainLoop’]();”>
<!–input type=“button” value=“Quit” onclick=“__exit(0)” –>
<input type=“button” value=“ClearStoredGame” onclick=“$.jStorage.flush()”>
</div>"

This is the section within the .html5 coding that you’d want to get rid of, or simply modify. You may want to read a bit further down into the code to make sure it’s all removed and exactly how you’d like it.

Thanks!

Thanks for playing so far into my game and finding the necessary code for me to change!

I was able to remove the buttons, but I’m still not entirely sure how to make the game auto-resume when the game window is being focused on.

I tried using: window.onfocus = Module’resumeMainLoop’];

Just after:

"&lt;div class="emscripten"&gt;
  &lt;input type="button" value="Fullscreen" id="fullscreen_request"&gt;
  &lt;input type="button" value="Pause" onclick="Module'pauseMainLoop']();"&gt;
  &lt;input type="button" value="Resume" onclick="Module'resumeMainLoop']();"&gt;
  &lt;!--input type="button" value="Quit" onclick="__exit(0)" --&gt;
  &lt;input type="button" value="ClearStoredGame" onclick="$.jStorage.flush()"&gt;
&lt;/div&gt;

&lt;textarea class="emscripten" id="output" rows="8"&gt;&lt;/textarea&gt;

&lt;script type="text/javascript"&gt;"

but that does not seem to work. Would you know how to solve this issue?

Thanks for the help, I greatly appreciate it!

Hey ,

" he issue is that I can click on the UMG buttons, but I cannot use the keyboard to move my character until I click “Resume.” Then a similar problem occurs when you click somewhere else on the page, then click back on the game – the only way to move the character is to click “Resume.”

Does this happen when you don’t use the kongrete website, eg - when you the run the game locally?

Hi ,

This does not happen when I run the game locally. I never have to click “Resume” to get the game to work properly.

I was surprised when I uploaded the game to Kongregate and had this issue – I’m not sure what the difference is between local and web.