1 / 13

Scratch Programming

Scratch Programming. Lesson 4 Question asking and answering. We are going to learn…. How to ask a question and receiving answer First touch of variable – answer Creating variables How to use If….. Else loop…. Forever IF vs. If Broadcast. Question asking and receiving answer.

satin
Télécharger la présentation

Scratch Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scratch Programming Lesson 4Question asking and answering

  2. We are going to learn… • How to ask a question and receiving answer • First touch of variable – answer • Creating variables • How to use If….. Else loop…. • Forever IF vs. If • Broadcast

  3. Question asking and receiving answer The answer will be stored in the “answer” variable Input answer here

  4. Variable • What is variable? • A storage location of some value or words • is a variable • When we ask more than one question, the latest one will over-write the previous one • More variables are needed for storage

  5. Creating variables Click here to create a new variable This box will pop-out and name should be given to the variable Choose the target user of the variable

  6. How to use variable Give a value to the variable Change the value of a variable by a certain number To control whether the variable will be displayed on the stage

  7. Operators (Part I) Addition, Subtraction, Multiplication and Division Smaller than, equal to OR greater than String- a sequence of characters String functions, 1) Join two strings together 2) Select one letter from the string depending on the position of the letter 3) Return the length of the string

  8. If… else • If the operation in returns a TRUE value, the commands here will start to run. • If the operation in returns a FALSE value, the commands inserted here will start to run.

  9. Forever If vs. If • Forever If • Non-stop to check the condition • If • Just check the condition once

  10. Forever If vs. If • Once the green flag is pressed • Would play meow sound whenever the mouse point to the sprite • Would play meow sound only when the mouse point at the time and the green flag is pressed at the same time

  11. Broadcast • Generate a message to the program • Set an object ( actor / background) to response when a message is broadcast by others

  12. How to use Broadcast The sprite gives a broadcast signal: change The stage changes to another background when receive the “change” signal

  13. Task of the lesson • Start a new program • In this program, the sprite can help you calculate 3 questions • The green flag will be the program starter • Input: • Tell the user that you are going to help them in • Allow the user to input 2 numbers, one by one • Output: • Return “Correct!” if you have the correct answer and change to another background with a background music • Return “Wrong!, the answer is ___” to return the correct answer to the user • The outputs will be displayed 2-3 seconds • Save your program and upload as Program4_3_ _ _ in eclass

More Related