To begin let's create the basic functionality for button A. Such that when button A is pressed, we play a pitch out of the speaker that corresponds to how far forward or back we are tilting the device.

To do this we need a "conditional statement" for when button A is pressed. We want to say "If button A is pressed, then play a pitch".

  • Grab an "if" statement from the "logic" tab and drag it inside the forever loop.
  • Next grab a "button A is pressed" statement from the "input" tab and replace it with the "true" element next that's part of the if statement.

This guide was first published on Apr 11, 2018. It was last updated on Apr 11, 2018.

This page (Conditional Statements) was last updated on Jan 15, 2022.

Text editor powered by tinymce.