is Pressed

Check if a button is being pressed or not.

isAbuttonpressed
JavaScript
(method) controller.Button.isPressed(): boolean;
Python
(method) controller.Button.is_pressed(): bool

Returns

  • a boolean: true if the button is pressed, false if the button is not pressed.

Example

Ramdomly move a yellow box around the screen while the A button is pressed.

Single player

isAbuttonpressedyellowBox3screen width3-pick randomtoyellowBox3screen height3-pick randomtosetytosetxtoifthenon game updatespriteof kindsetyellowBoxtoon start

Multiplayer

isplayer2AbuttonpressedyellowBox3screen width3-pick randomtoyellowBox3screen height3-pick randomtosetytosetxtoifthenon game updatespriteof kindsetyellowBoxtoon start

See also

on event