Presentation is loading. Please wait.

Presentation is loading. Please wait.

Creating Variables Output Logic flow Operators (More) Basic blocks

Similar presentations


Presentation on theme: "Creating Variables Output Logic flow Operators (More) Basic blocks"— Presentation transcript:

1 Creating Variables Output Logic flow Operators (More) Basic blocks
Lesson 3 Creating Variables Output Logic flow Operators (More) Basic blocks

2 Recall… Blocks that you’ve learnt:

3 Creating Variables To store a value of something.
May change during the game. E.g. Time Score etc.

4 Creating Variables ***INITIALIZATION!***
Show (clicked)/ hide (unclicked) the value on the stage area Set the value of the variable ***INITIALIZATION!*** Change the value of the variable +ve number (k): add k to the original value +ve number (-k): minus k to the original value This can be dragged to the scripts area

5 Output (Output) A sprite can say / think (something) for (some) seconds / forever.

6 Logic flow (control) If (something) is correct, then do the followings. If (something) is correct, then do the followings, otherwise, do the followings. Wait until (something) is correct, then continue.

7 Operators Randomization Logic operators Math operators

8 (More) Basic blocks Show/hide (Looks)
Mouse down (sensing): when the mouse is left-clicked. Wait (control)

9 Exercise 3 Your task is to create a game of guessing a number from 1 to 10 if it is an odd or even number. Features: Generate a random number from 1 to 10. The cat asks the question. (I have a number from 1 to 10 in mind. Do you think it's odd or even?) SHOW the two buttons (odd/even). WAIT for the user to CLICK ON the button (odd/even). Check if the answer is correct. The cat says (Yay! You're correct!) if it is correct, otherwise, it says (Oops! You're wrong.).

10 Hints on Ex 3 For an odd number x, x  1 (mod 2)
(when you divide an odd number by 2, the remainder is 1) For an even number y, y 0 (mod 2) (when you divide an even number by 2, the remainder is 0) Make sure that the user has to CLICK ON the button, but not just mouse over the button nor mouse clicked anywhere on the screen.


Download ppt "Creating Variables Output Logic flow Operators (More) Basic blocks"

Similar presentations


Ads by Google