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

質問

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.

役に立ちましたか?

解決

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

他のヒント

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

Example:

if(keyboard_check(vk_escape)) { 
    game_end();
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top