How do I close a GameMaker game by pressing the back button on an Android device?

StackOverflow https://stackoverflow.com/questions/21942983

  •  14-10-2022
  •  | 
  •  

Question

Is there a way to close the game by pressing the back button on an Android device?

I haven't been able to get it to work.

Était-ce utile?

La solution

On mobile devices, the back button is mapped to the keyboard backspace, vk_backspace, which can be used like this:

if (keyboard_check_pressed(vk_backspace)) {
    game_end();
}

From the manual: https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/controls/device%20input/index.html

Autres conseils

Just call game_end() when you want to close your game.

Example:

if(keyboard_check(vk_escape)) { 
    game_end();
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top