on Event

Run some code when a touch sensor is pressed, bumped, or released.

sensors.touch1.onEvent(ButtonEvent.Bumped, function () {



  • ev: the touch sensor action to run some code for. The touch actions (events) are:
    • pressed: the sensor was pressed, or pressed and released
    • bumped: the sensor was just bumped
    • released: the sensor was just released
  • body: the code you want to run when something happens to the touch sensor.


Check for an event on touch sensor touch 1. Put an expression on the screen when the sensor is released.

sensors.touch1.onEvent(ButtonEvent.Released, function () {

See also

is pressed, was pressed, pause until