Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

Al Asriyya School

Created by Aseel AlSinjilawi


Sequence, Selection,
Repetition, Hide and Show
Aim
I can control when objects need to be visible.
I can use sequence and repetition in programs.

Success Criteria
• I can locate and insert the ‘show’ and ‘hide’ blocks in a script.
• I can locate the correct place for a sprite to appear visible.
• I can make a sprite invisible when it is not active in the code.
Instructing the Computer?
There are three main ways to control
how a computer will run the sequencing
instructions or commands you enter.

selection

repetition
Sequencing
A sequence of instructions tells the computer to run your commands in order, or
sequence, starting from the first one and finishing at the
last one.
The directions for getting from home
One everyday
to school are an example of a
example of a
sequence.
sequence is • Leave your house.
a recipe. • Walk down the path.
• Turn right.
Can you think of • Follow the road for 200 metres.
any more? • Turn left.
• Follow the road for 50 metres.
• Cross the road.
• Go through the school gates.
Selection “IF, THEN and ELSE “
Sometimes, we only want the computer to carry out commands if certain
conditions are met. We want to tell the computer to ignore some commands and
select other commands.
The words IF, THEN and ELSE are key words for using selection.

Computer games make use An everyday example of


of selection all the time. selection is a kettle
IF a character touches a gold boiling.
coin IF the water is boiling
THEN receive one point THEN switch the power
ELSE score stays the same. off
ELSE keep the power on.
ELSE is a computers way of Can you think of any
saying OTHERWISE. more?
Repetition “ Repeat , Forever“
If we want the computer to run the same commands more than once, we can use
a REPEAT function. To do this, we add a LOOP into the program. When the
computer reaches the last command in the loop, it goes back and repeats them
all. This can save us having to rewrite the same code over and over again.

One everyday
example of repetition
would be traffic lights
which repeat the
same cycle of colours
over and over again.
Can you think of any
more?
Sequence, Selection and Repetition
Often all three of these are used together to make programs run as efficiently as
possible.
Can you think how these are used to control an automatic car
park barrier?

Sequence Selection
• barrier up • If ticket inserted, raise barrier.
• barrier down • If car has passed through, lower barrier.

Repetition
• ticket in
• barrier up
• wait
• barrier down
Show and Hide

These can be inserted into scripts


for each character sprite, to make
them appear and disappear when
you want them to be.

You might also like