Games built for GX.Games target do not clear keypresses when the iframe with this game loses focus. Games for HTML5 target do not have this problem.
For example, a player may press the "Right Arrow" key. Then he may click outside the play area on the game page without releasing it. The game would lose focus, and after a player releases the key the game would still think that the key is pressed.
The example is on the video below. I clicked outside the game area, then the button "Continue" appeared, and after that I released the "Right Arrow" key. You may see that the character is still walking (although the key is already released by this moment).
It is also possible to reproduce the bug without uploading the game to GX.Games but just by testing the game locally. This option is described in "Steps To Reproduce" section.
The game should clear the keypresses when the game gets unfocused (like HTML5 runner does)
Steps To Reproduce
Start GameMaker.
Create a new game using "Windy Woods" template.
Set up the targets. Platform: "GX.Games". Output: "GMS2 VM" (as for YYC output, I didn't check it).
Press "Run" in the toolbar.
When the page is opened in your browser, open the developer tools.
Start a new game. Press "Right Arrow" so that the character would start moving.
Click somewhere inside the developer tools to unfocus the game.
Release "Right Arrow".
Observe that the character keeps moving.
(Optionally) go back to the game. Observe that the character will stop moving only after you press and release "Right Arrow" once again.
Note 1: "Windy woods" is designed in such a way that the character stops once it meets any obstacle (and its animation switches to the idle state as well). So you need some free space ahead of him.
How reliably can you recreate this issue using your steps above?
Always
Which version of GameMaker are you reporting this issue for?
Description
Games built for GX.Games target do not clear keypresses when the iframe with this game loses focus. Games for HTML5 target do not have this problem. For example, a player may press the "Right Arrow" key. Then he may click outside the play area on the game page without releasing it. The game would lose focus, and after a player releases the key the game would still think that the key is pressed. The example is on the video below. I clicked outside the game area, then the button "Continue" appeared, and after that I released the "Right Arrow" key. You may see that the character is still walking (although the key is already released by this moment). It is also possible to reproduce the bug without uploading the game to GX.Games but just by testing the game locally. This option is described in "Steps To Reproduce" section.
https://github.com/YoYoGames/GameMaker-Bugs/assets/93122583/e75f5f74-f63b-47a6-97f4-4f8627601309
Contact Us package: ContactUs - keypresses (1).zip
Expected Change
The game should clear the keypresses when the game gets unfocused (like HTML5 runner does)
Steps To Reproduce
How reliably can you recreate this issue using your steps above?
Always
Which version of GameMaker are you reporting this issue for?
2023.8.2 (Monthly)
Which platform(s) are you seeing the problem on?
GX.games
Contact Us Package Attached?
Sample Project Added?