YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
21 stars 8 forks source link

In-Game, GX.Games: Keypresses are not cleared on GX.Games platform #2082

Closed opera-pavelg closed 10 months ago

opera-pavelg commented 10 months ago

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

  1. Start GameMaker.
  2. Create a new game using "Windy Woods" template.
  3. Set up the targets. Platform: "GX.Games". Output: "GMS2 VM" (as for YYC output, I didn't check it).
  4. Press "Run" in the toolbar.
  5. When the page is opened in your browser, open the developer tools.
  6. Start a new game. Press "Right Arrow" so that the character would start moving.
  7. Click somewhere inside the developer tools to unfocus the game.
  8. Release "Right Arrow".
  9. Observe that the character keeps moving.
  10. (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?

2023.8.2 (Monthly)

Which platform(s) are you seeing the problem on?

GX.games

Contact Us Package Attached?

Sample Project Added?

Emc1923 commented 9 months ago

Verified in IDE v2023.11.0.120 Runtime v2023.11.0.157