Sprite::whenKeyPressed()
Called when a key is pressed, once per press (holding a key down does not repeat it).
Examples
Syntax
Java
.whenKeyPressed(key)
Scratch
when [space v] key pressed
Parameters
| Name | Data Type | Description |
|---|---|---|
| key | KeyCode | the key |
Return
void