• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android HOW to code 'WASD' controls on CHROMEBOOK??

JesterOC

Member
So my friend has a Chromebook and has been helping me test my project...
I have WASD code using the keyboard_check() function as such:
Code:
var W = keyboard_check(ord("W"));
that works on PC, but somehow fails on Chromebook?
I trieded changing it to:
Code:
var W = keyboard_check_direct(ord("W"));
but apparently that doesn't work either...

Anyone got any ideas/suggestions on what to do? I'm stumped.
 

BenRK

Member
I seem to remember some platforms use the lower case W when using ord(), have you tried that?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
I seem to remember some platforms use the lower case W when using ord(), have you tried that?
That should NEVER be the case and if it is then it's a bug and someone should make a test project proving the issue and letting YYG know...

As for the issue with the keyboard... How are you running the game on the Chromebook? Natively, Chrome OS doesn't run EXE files, so what are you doing to have it run on the device? Are you using the Linux export instead as I believe that could run (assuming you have the correct dependencies installed)? Or are you building an Android app? If it's Android, then keyboard input just won't work as that export does not support the keyboard events... That said, you can debug the input from the keyboard using keyboard_string or keyboard_lastchar to get the letter/code for what keys are being pressed. It may be that you can simply parse and clear keyboard_string every step to get the input and make it work on both platforms.
 

JesterOC

Member
As for the issue with the keyboard... How are you running the game on the Chromebook? Natively, Chrome OS doesn't run EXE files, so what are you doing to have it run on the device? Are you using the Linux export instead as I believe that could run (assuming you have the correct dependencies installed)? Or are you building an Android app? If it's Android, then keyboard input just won't work as that export does not support the keyboard events... That said, you can debug the input from the keyboard using keyboard_string or keyboard_lastchar to get the letter/code for what keys are being pressed. It may be that you can simply parse and clear keyboard_string every step to get the input and make it work on both platforms.
Compile Android .apk, so looks like I'll have to parse keys for android? Thats so lame tho, what if the player wants hold down 2 keys?

This sounds do-able... Though quite a pain... 👍🤠

Thinking maybe i could write an Android extension? Just to detect WASD proper on Chromebook...
 

JesterOC

Member
I've been trying to get this to work, no luck so far with it :(

The problem happens if the player wants hold down 2 keys....it just can't detect if the first button is still held or released....

Compile Android .apk, so looks like I'll have to parse keys for android? Thats so lame tho, what if the player wants hold down 2 keys?

This sounds do-able... Though quite a pain... 👍🤠

Thinking maybe i could write an Android extension? Just to detect WASD proper on Chromebook...
I also tried making an android extension.... it failed, but i shall try again soon...
 

JesterOC

Member
The Virtual Keyboard page got a way to make clickable areas on screen, but if you really need keyboard input.. the ..you might need that extension of yours ^^;;
Virtual keys doesn't solve multi-key problem:

The problem happens if the player wants hold down 2 keys....it just can't detect if the first button is still held or released....
I will try my hand at making it as an android extension..
 

GMWolf

aka fel666
The problem happens if the player wants hold down 2 keys....it just can't detect if the first button is still held or released....
Is it any two keys? Or just some?
Some keyboards cannot detect some combinations of keys being pressed (a hardware limitation). These will usually be keys that form an L shape, for example W and D.
If it's any two keys, like A and G, or any other combination, then it's likely a software issue (either os, GML or you)
 

JesterOC

Member
Is it any two keys? Or just some?
Some keyboards cannot detect some combinations of keys being pressed (a hardware limitation). These will usually be keys that form an L shape, for example W and D.
If it's any two keys, like A and G, or any other combination, then it's likely a software issue (either os, GML or you)
ye it's software, I was only testing keyboard_string and keyboard_lastchar on my PC,
and 2 keys works....
just that it retains movement in direction 2... [line edited]
if still holding key1 after released key2.
(it should go in direction 1 again) [line edited]

was using this code below to check fer no key press, and that is why it doesn't halt movement if still holding key1 after released key2...

Code:
//if not pressing, reset speed/key
if keyboard_check(vk_nokey) {
speed = 0;
keybo_key = "";
keybo_key_2 = "";
keyboard_string = ""
}
 

JesterOC

Member
Reading through this thread,
I found this site to check capability the hardware of the Chromebook: http://gadzikowski.com/nkeyrollover.html

Also, keep in mind a Chromebook may use Chrome OS, not Android. Chrome OS is not supported by GM2.
He sent me a screenshot of the project...
It's running on it after i send him .apk

Edit: i just saw ur link, looks useful... Will prolly use that if we run into problems with building an android extension.
 
Top