Scratch Programming - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Scratch Programming

Description:

Scratch Programming Lesson 5 Programming logic We are going to learn Initialize the variables SET VS CHANGE Operator (Part II) Use a variable as a counter ... – PowerPoint PPT presentation

Number of Views:140
Avg rating:3.0/5.0
Slides: 10
Provided by: Mandy62
Category:

less

Transcript and Presenter's Notes

Title: Scratch Programming


1
Scratch Programming
  • Lesson 5Programming logic

2
We are going to learn
  • Initialize the variables
  • SET VS CHANGE
  • Operator (Part II)
  • Use a variable as a counter

3
Initialization
  • give an initial setting of a variable or set an
    initial setting
  • use set functions
  • for example,

4
SET VS CHANGE
  • See the following example
  • What are the effect respectively?


The sprite will change its y co-ordinate by 10 whenever up arrow key is pressed The sprite will go to y10 whenever up arrow key is pressed
When the sprite is originally on y10 When the sprite is originally on y10
The sprite will move up by changing y co-ordinate The sprite will stay on y10
5
Operators (Part II)
One number will be randomly chosen from the range
given
These three are operators (i.e. return True or
False)
AND OR NOT

True True False

False True True

False False False
6
Operators (Part II)(cont.)
  • Extra functions

Mod Round
Reminder after division Round off the value with decimal places

Some more Maths function here
7
Use variable as a counter
  • Two methods have the same result


Adv easier to write Adv Can use the variable to set different cases at different values
Disadv cannot tell which repeat values is running Adv more difficult to write
8
You can EXPLORE more by trying those functions
and right-click to find the help bubble
9
Task of the lesson
  • The sprite will give the user 3 chances to enter
    a number from a range within the limit of 1 -15
  • If the number guess is correct, suitable display
    e.g. music and background will be shown
  • If the number guess is incorrect, suitable
    display e.g. music and background will also be
    shown
  • The number of guess left will be displayed
  • The initialization of the a program has been
    given. Complete the rest of the program.
Write a Comment
User Comments (0)
About PowerShow.com