Swim along the Edges of the Ocean

Overview

  • Program the Orca to swim along the four sides of the ocean.

Objectives

  • Become familiar with visual programming.

  • Program the Orca to swim using basic motion commands.

  • Learn coordinate system with direction (0-360 degrees) and distance.

  • Understand sequential execution of commands and conditional (if-else) statement.

Steps

Let's review the following coding blocks before we start to swim.

  • : The blocks attached to this block start to execute after tapping the Play button.

  • : The block will play the sound of the selected audio file.

  • : The blocks inside this block will be executed n number of times.

  • : The blocks inside this block will execute forever until the stop button is tapped.

  • : The block will check its boolean condition, if the condition is true then the code inside this block will run.

Coordinate system

  • Before digging into the steps, you may need to discuss the coordinate system for Orca. The figure shows the relationship between the direction and the Orca's moving angle.

Create an Orca Project

  • Open Tickle app and go over the welcome tutorial that shows you how to drag and drop coding blocks. You can replay the tutorial in Settings -> Show Introduction as needed.

  • If you don't already have a Orca project open, create a new one by tapping "+ New Project" in "MY PROJECTS". Choose the template with the name "Orca".

Let's Swim!

  • In order to make Orca move across the screen forever, we first drag out the block forever and put it under the block When starting to play, then put the block move 10 steps inside the mouth of the block forever.

  • To make the Orca turn left by 90 degrees, there are several ways to complete this goal. We can use the block repeat 10 times and put the block turn left by 9 degrees inside it, or we can simply use the block turn left by 90 degrees.

  • Here we make use of the conditional block called if ... then. When the condition in the if ... then block occurs (ie. is TRUE), then the code inside that block runs; otherwise, none of the code inside runs.

  • Then we make use of one of the sensing blocks called touching edge?. When the Orca touches the edge of the stage screen, the condition in block if ... then returns TRUE and the code inside the block runs.

  • Combine the blocks from above steps and add a sound block play sound (or you can choose whatever you want in the soundtrack list) inside the conditional block if ... then. The Orca will repeatedly move 10 steps and check to see if it's touching an edge. If the Orca is touching an edge, then it turns left by 9 degrees for 10 times (for a total of 90 degrees).