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
  •  | 
  •  

Pregunta

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.

¿Fue útil?

Solución

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

Otros consejos

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

Example:

if(keyboard_check(vk_escape)) { 
    game_end();
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top