Android back button

Previous topic - Next topic

MrPlow

Hi Guys

Noticed something on this and wanted to offer tip on using Android Back button...

If using multiple KEY(1) to test for back presses, use it once per loop and store in variable.

As I found KEY(1) did not detect on my second statement - gave me a headache for few hours before I copped the issue.

Code (glbasic) Select
LOCAL getbackkey = KEY(1)

IF getbackkey AND...

IF getbackkey AND ...


Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

#1
If im remember right, KEY(1) only detect once per press. So its a toggle key. So its return to zero soon after use.

This has allways been that since Android SDK version and im did not change that to Android Studio. Not sure im should have do that throught. But this has been on in years really!

This is so you dont accidently activate the back button twice to suddently quit the game instead.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Yes, that is fine...I can see the logic :)

I wansn't sure it was meant - as I previously used AE ("menu") command to do my other back button presses.

But only only once per loop is fine.
It was just that testing for the keypress would fail for subsequent tries in multiple 'IF' tests and I wanted to help others - in case they tried the same :)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs