touch()

Touch is a built-in function in Bitsbox. The code you put inside the touch function only runs when someone first touches their finger (or cursor) to the screen. When someone taps the screen, that interaction starts with a touch. (It ends with an untouch.)

Before the function is called, the global variables x and y are set to the current location of the user's finger.

So what's the difference between tap and touch? Tap only happens if you touch the screen then immediately remove your finger. Touch happens even if you leave your finger on the screen.

This program draws a stamp wherever you touch your finger. Note the use of the x and y variables.