Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Scratch Programming Lesson 5 Programming 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 y=10 whenever “up arrow key” is pressed When the sprite is originally on y=10… The sprite will move up by changing y co-ordinate The sprite will stay on y=10

5 Operators (Part II) One number will be randomly chosen from the range given ANDORNOT True False True False These three are operators (i.e. return True or False)

6 Operators (Part II)(cont.) Extra functions ModRound Reminder after divisionRound 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 writeAdv: 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

9 Task of the lesson Write a program to guess a random number from a range The sprite will give the user 3 chances for the user to enter a number from a range with lower limit of 1 -5 and upper limit from 5 – 10 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 on screen


Download ppt "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."

Similar presentations


Ads by Google