0% found this document useful (0 votes)
110 views

HKICO_Scratch

Uploaded by

Sharon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views

HKICO_Scratch

Uploaded by

Sharon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

1.

About Scratch background

- It was initially released in 2007 by Mitchel Resnick, who is the LEGO Paper
Professor of Learning Research and the head of the Lifelong Kindergarten Group
at the MIT Media Lab.

- The Scratch project has received financial support from the following
organizations:
 National Science Foundation
 Scratch Foundation
Siegel Family Endowment
 Google
 LEGO Foundation
 Intel
 Cartoon Network
 Lemann Foundation
 MacArthur Foundation

- The Scratch project is under direct maintenance by Lifelong Kindergarten Group,


MIT media Lab

2. Operators

A. Logical Operators (AND, OR, NOT)

A B A AND B NOT (A AND B)


False False False True
True True True False
True False False True
False True False True

A B A OR B NOT (A OR B)
False False False True
True True True False
True False True False
False True True True
B. Relational Operators

- > (greater than)

- < (less than)


- = (equal to)

Exercises

i. 10 < 5

ii. 3>2

iii. 7=7

iv. 4<6

v. -3 < -2

i) (10 > 5) and (3 < 2) i) not ((10 > 5) and (3 < 2))

ii) (7 = 7) or (4 > 6) ii) not ((7 = 7) or (4 > 6))

iii) (10 > 5) and (7 = 7) iii) not ((10 > 5) and (7 = 7))

iv) (3 < 2) or (4 > 6) iv) not ((3 < 2) or (4 > 6))

v) (10 > 5) and (4 > 6) v) (10 > 5) and not (7 = 7)


i) (10 > 5) and not (3 < 2) or (7 = 7)

ii) not (7 = 7) or (4 > 6) and (3 < 2)

iii) (10 > 5) and not (7 = 7) or not (4 > 6)

iv) not (3 < 2) or (4 > 6) and not (10 > 5)

v) (10 > 5) and not (4 > 6) or (3 < 2)

C. Arithmetic Operators (BIDMAS)

- ‘+’ (Addition)

- - (Subtraction)

- * (Multiplication)

- / (division)
 10/5 = 2

- MOD (modulus)
 10 MOD 2 = 0

i. 15 * 4 - 7 / 2
ii. 20 MOD 6.
iii. (8 - 3) * 2 + 10 / 5
iv. 25 / 5 - 3 + 4 MOD 2
v. 12 * 3 - 5 / 2

3. Broadcast
Broadcast is a message that user can send through the Scratch program
activating scripts with matching Hat blocks.
They are useful in creating games and animation projects as they trigger specific
scripts.

There are 3 major Broadcast blocks available in Scratch.

It is an Events and Hat block used


to activate its scripts when the
given broadcast message has
already been sent to the complete
project.

It is an Event and Stack block used


to send a broadcast message to
the complete project.

It is an Event and Stack block used


to send a broadcast message to
complete project. This block sends
the broadcast messages and waits
until all script gets activated and
then stop running.

Example 1:
Example 2
Exercise_1
Exercise_2
Exercises_3
The sprite is supposed to do the following things in sequence:
1. Glide to a random postion
2. After that, it has to say it got a new place
3. Then, switch the costume
Check the following program and find out what happended.
4. Override blocks

Blocks Output Remarks


The sprite will only The sprite didn’t say
think Hmm… Hello at all

The sprite will only say The sprite didn’t say


Hi! Hello at all

The sprite will say There is no override


Hello for 2 seconds block in this program
think Hmm….
The sprite will directly The sprite didn’t move
move to x:10 y:0 for 10 steps at all

The sprite will go to There is no override


x:10 y:0, then move for block in this program
10 steps

The sprite will only go The sprite didn’t go to


to x:0, y:100 x:100 y:0 at all

The sprite will go to There is no override in


x:100 y:0. After 1 this program.
seconds, it will go to
x:0 y:0.

5. Coordinate points and motion blocks


1.

After moving 10 steps, what is the position of x and y?

2.

After moving 10 steps, what is the position of x and y?

3.
After moving -20 steps, what is the position of x and y?

4.

The initial point is x:0 y:0. After clicking the green flag, what will be the position of x?

5.

The initial point is x:0 y:0. After pressing space key for 5 times, what will be the
position of x and y?

6.
Fill the x and y positions to get a square shape.

7.

After green flag is clicked, answer the following questions:


a) What will be the position of x and y?
b) Which direction that the sprite will be faced? (-90 or 90)
8.

The initial point is x:0 y:0. After clicking the green flag, what will be the position of x?

9.

The initial point is x:0 y:0. After repeating 10 times, what will be the position of x?
10.

The initial point is x:60 y:0. After repeating 5 times, what will be the position of x?

11.

The initial position is x:0 y:0 and direction is 90.


After green flag is clicked, answer the following questions:
a) What will be the position of x and y?
b) At which direction the sprite be? (-90 or 90)
c) Which direction that the sprite will be faced? (left or right)
12.

The initial position is x:0 y:0 and direction is 90.


After green flag is clicked, answer the following questions:
a) What will be the position of x and y?
b) At which direction the sprite be? (-90 or 90)
Which direction that the sprite will be faced? (left or right)

6. Iteration, Variable and conditional selections


1.

After running the program, what is the value of my variable?

2.

After running the program, what is the value of count?

Forever loop and Repeat until….


Exercises

1. Rewrite the program using repeat until.

2. Complete the broadcast part. After that, rewrite the program using forever loop.
Wait until…………

1.

Answer the following questions:


a) How can the program start?
b) What happens right after the program starts running?
c) How can the sprite be enabled to say Hello!

2. Rewrite the above program without using “wait until……”.


7. Clones
A clone is an exact copy of a sprite which inherits also all the scripts. This is
useful if you want to create multiple sprites which have similar behavior.
There are 3 clone-related blocks:
A hat block to start as a clone

A stack block to clone the current


sprite

An end block to delete the clone


(and stops its scripts)

In Scratch, clone is spawn means you are creating a new instance or copy
of a sprite during the runtime of the program. This clone behaves similarly to the
original sprite but operates independently.

Examples

You might also like