Why arrowKey is not very useful
Posted: Tue Jul 14, 2020 8:51 pm
I have a set of online pupils/students just now who are trying to make simple games where the 'hero'
is controlled by the arrow keys on the computer keyboard a bit like this;
BUT . . . the main problem is that if an end-user keeps pressing an arrow key the key keeps sending keyDown signals
which is not desirable.
This has been an ongoing problem for some years.
If we change our control keys to, let us say the W, A, S & Z keys we can overcome that problem by using keyUp rather than keyDown.
But arrowKey is a sort of kinky keyDown confined to the arrow keys, there is not the possibility of either
(pseudoCode) arrowKeyDown or arrowKeyUp
I have been chewing over this one for a long, long time (well, about 5 years on and off) and, reluctantly reached
the conclusion that using arrowKeywhen one wants to use the arrow keys is not very useful at all.
And doing this sort of thing when I want to use the arrow keys:
is controlled by the arrow keys on the computer keyboard a bit like this;
Code: Select all
on arrowKey AK
put item 1 of the loc of grc "ANT" into LR
put item 2 of the loc of grc "ANT" into UD
switch AK
case "up"
set the backgroundpattern of grc "ANT" to the ID of img "A1.png"
move grc "ANT" to LR,(UD-12)
break
---and so on and so forth
end switch
end arrowKey
which is not desirable.
This has been an ongoing problem for some years.
If we change our control keys to, let us say the W, A, S & Z keys we can overcome that problem by using keyUp rather than keyDown.
But arrowKey is a sort of kinky keyDown confined to the arrow keys, there is not the possibility of either
(pseudoCode) arrowKeyDown or arrowKeyUp
I have been chewing over this one for a long, long time (well, about 5 years on and off) and, reluctantly reached
the conclusion that using arrowKeywhen one wants to use the arrow keys is not very useful at all.
And doing this sort of thing when I want to use the arrow keys:
Code: Select all
on rawKeyUp XXX
put item 1 of the loc of grc "ANT" into LR
put item 2 of the loc of grc "ANT" into UD
switch XXX
case "65362" --- this is the rawKey code for the 'up' arrow key
set the backgroundpattern of grc "ANT" to the ID of img "A1.png"
move grc "ANT" to LR,(UD-12)
break
---and so on and so forth
end switch
end rawKeyUp