keyIsDown()
Checks whether a certain key is down
Example

# W keyCode = 87
if keyIsDown(87):
# move square up
# ...
# S keyCode = 83
if keyIsDown(83):
# move square down
# ...
# A keyCode = 65
if keyIsDown(83):
# move square left
# ...
# D keyCode = 68
if keyIsDown(83):
# move square right
# ...
Default inputs
keyIsDown(VALUE)
Input
Description
VALUE
key code of the key being checked
Description
The keyIsDown() function checks if a certain key is currently down (Pressed). It returns True
if that key is down, and False
if it does not. (Boolean datatype)
For example, keyIsDown(
38
)
checks whether the up arrow is being pushed, since 38 is its keycode.
Similarly, keyIsDown(
UP_ARROW
)
checks for the same thing, because UP_ARROW is a constant that stores the key code of the up arrow, other such constants include DOWN_ARROW, ENTER and SHIFT.
In general, you can search the web for: key code of ###
or look at this website.
Last updated