<< Chapter < Page
  Teaching beginners to code     Page 8 / 9
Chapter >> Page >

Two groups of programming blocks have the correct shape

Unless I missed seeing some others, there are only two buttons at the top center of Image 4 that expose blocks having the required shape:

  • Sensing (light blue)
  • Operators (green)

In this case, we will select and use a block from the light blue Sensing group. (We will use programming blocks from the green Operators group in a future module.) All of the blocks belonging to the Sensing group are shown in Image 12 .

Image 12. programming blocks belonging to the sensing group.

Missing image.
Image 12. Programming blocks belonging to the Sensing group.

Will use the touching block

We will use the block labeled touching followed by a pull-down list and a question mark.

The items that appear in the pull-down list depend on the sprites that have been added to the program. Forthis program, that list consists of the following choices when the basketball has been selected for programming:

  • mouse-pointer
  • edge
  • LeftBeachball
  • RightBeachball

The top two choices are always there. The remaining choices depend on the sprites that have been added to the program and the sprite that has been selected for programming.

(Note that the Basketball sprite does not appear in the above list because it was selected for programming when I examined the list. In otherwords, you can't determine that the basketball is touching itself.)

Go back and examine the script

Going back to the bottom script in Image 8 , you can see that I dragged two copies of the if block shown in Image 11 into the rightmost panel andconnected the blocks as shown in Image 8 . Then I dragged two copies of the touching block from the Sensing group shown in Image 12 , and dropped each of those blocks into the corresponding locations in the if blocks in Image 8 .

Then I selected RightBeachball from the pull-down list for one of the touching blocks and selected LeftBeachball from the pull-down list for the other touching block.

Conditions have been established - need actions

At this point, I had the conditions for the two selection structures established, but I hadn't yet specified the actions to be taken when one or theother of the conditions is found to be true.

Programming blocks belonging to the Motion group

Image 4 shows all of the programming blocks that are exposed by clicking the Motion button at the top center of Image 4 .

You saw three of the programming blocks from Image 4 being used in Image 6 , Image 7 , and immediately below the top tan block in the bottom script in Image 8 . Now we need to use another of the programming blocks from Image 4 .

Turn around and face the other way

Recall that the blue point in direction block in the top script in Image 8 causes the basketball to turn to face to the right when the user clicks the green flag.

The two turn blocks in the bottom script in Image 8 cause the basketball to rotate around its center by 180 degrees. This, in turn,causes it to face in the opposite direction from the direction that it was previously facing. (It also turns it upside down, but that doesn't matter for a round basketball.)

Questions & Answers

what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Teaching beginners to code. OpenStax CNX. May 27, 2013 Download for free at http://cnx.org/content/col11498/1.20
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Teaching beginners to code' conversation and receive update notifications?

Ask