0% found this document useful (0 votes)
4 views6 pages

Scratch Math Game Project Guide

Uploaded by

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

Scratch Math Game Project Guide

Uploaded by

swisscraftsz
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

17/10/2017 Meeting 3

Steps:
1
Opening the Scratch Application

To open Scratch, go to Start ► All Programs


► Scratch folder ► Scratch.

You can simply double-click on the Scratch


Shortcut on your Desktop Desktop to open
the application.

2
Download and extract required zip file.
From the Downloadables section, download
the file Do the [Link]. Extract this file by
right-clicking on it and selecting Extract Here.
You should be able to see a folder named
Do the Math after extracting.

3
Opening a Project

Open a project by clicking File ► Open in the


Menu.

in the Open Project window, locate the Do the


Math folder. In this folder, choose Do the Math
then click OK.

4
Add scripts to the GameMaster sprite. When
the green flag is clicked, the GameMaster
sprite should ask four (4) mathematical
question, wait for the user input, and tell if
the input is right or wrong. If the answer is
correct, the GameMaster should broadcast a
message to make a specified group of trash
disappear from the stage.

Select the GameMaster sprite from the


Sprite List then click on the Scripts Tab
below the Current Sprite Info. To start the
script execution, drag the Control block

4/9
17/10/2017 Meeting 3

when green flag clicked and drop it on the


Scripts Area of the GameMaster sprite.

Create a variable that will monitor the


question count by clicking the Variables
category > Make a variable [Link] the
variable [Link] time the green
flag is clicked, the questionCount should be
reset to 1. To do this, place the set
[questionCount] to [1] below the when green
flag clicked Control [Link] GameMaster
should ask a question only if the
questionCount is greater than 0 and less
than 5 since there are only 4 questions
available (questions 1-4). To do this, add a
loop that will continue to iterate while a
specified condition is true.

Below the Variables block, add a Control


blockblock forever if <>. As a condition, add an
<>and<> Operators block. For the first
condition of this block, add questionCount>0
and for the second condition, place
questionCount<5. Inside the forever if <>
block, add an If statement that would check
what question number are we currently in.
This is done in order to display the correct
question for that specific number.

Inside the If block, add the Sensing block


ask [ ] and wait. For question number 1, the
question is “25 times 4 is equal to?” Place
this question inside the ask [ ] and wait
block. After asking the question, the answer
should now be evaluated whether it is right
or wrong. To do this, use an If else block.
Place the condition answer=100 in the If
statement where 100 is the correct answer
to the question 25 times 4 is equal to?.
Inside the If statement with the condition
answer=100, add the Looks block say [ ] for 2
secs. Replace Hello! with "Correct".

Below the Looks block, add a wait (1) secs.


Replace 1 with 0.5. This is done to make
the trash disappear 0.5 seconds after the
GameMaster say “Correct!” To make the
trash sprites disappear, add a broadcast
block broadcast [ ]. Click the drop down
arrow then select newin this block. Input
removeTrash1 as the broadcast message.
Inside the else statement, add the Looks
block say [ ] for 2 secs. Replace Hello! with
"Your answer is incorrect".

Duplicate the If block 3 times for questions


2-4. Place the duplicates after the first If
block. You should now have 4 If blocks
inside the forever if <> block. Make the
necessary modifications for the duplicates.

First duplicate:
• Change the condition of the If
statement to questionCount = 2. Replace
the question with “150 minus 26
is equal to?”
Replace the condition of the If
statement in the If else block to
answer=124
5/9
17/10/2017 Meeting 3

Replace the broadcast message to


removeTrash2

Second duplicate:
Change the condition of the If
statement to questionCount = 3. Replace
the question with “234 + 16 is
equal to?”
Replace the condition of the If
statement in the If else block to answer
= 250
Replace the broadcast message to
removeTrash3

Third duplicate:
Change the condition of the If
statement to questionCount = 4. Replace
the question with “65-7 is equal
to?”
Replace the condition of the If
statement in the If else block to answer
= 58
Replace the broadcast message to
removeTrash4

For every iteration of the forever if <>


block, the questionCount should increment
by 1. To do this, place a Variable block
change [questionCount] by (1) right after the
last If block.

Place scripts to the trash sprites.

You would notice that the trash sprites are


named trashx.y where x is the group where
the trash belongs to. The trashes named
trash1.y would disappear when question 1
is answered correctly, trash2.y would be
hidden when question 2 is answered
correctly, and so on.

Make trash sprites from group 1 (trash1.1,


trash1.2, and trash 1.3) disappear.

To make the sprites from group 1 disappear


when question 1 is answered correctly, add
a Control block when I receive [removeTrash1].
Below this block, add the Looks block hide.

Make trash sprites from group 2 (trash2.1,


trash2.2, and trash 2.3) disappear.

To make the sprites from group 2 disappear


when question 2 is answered correctly, add
a Control block when I receive
[removeTrash2]. Below this block, add the
Looks block hide.

6/9
17/10/2017 Meeting 3

Make trash sprites from group 3 (trash3.1


and trash 3.2) disappear.

To make the sprites from group 3 disappear


when question 3 is answered correctly, add
a Control block when I receive [removeTrash3].
Below this block, add the Looks block hide.

Make trash sprites from group 4 (trash4.1


and trash 4.2) disappear.

To make the sprites from group 4 disappear


when question 4 is answered correctly, add
a Control block when I receive [removeTrash4].
Below this block, add the Looks block hide.

Try clicking the green flag and answer the


questions correctly. You would notice that
when the trash sprites disappear from the
6 stage, the only way to display them again is
to right-click on the sprite from the Sprite
List and select show. To make all of them
appear in one click, add the block when
green flag clicked and show block below it to
all trash sprites in the project.

Save the project

Save the project by clicking File ► Save in


7 the Menu

You can simply pressCTRL + S on your


keyboard to save the project.

Play with the project.

Click the green flag to start the execution.


Provide the correct answer for some
questions and answer the others incorrectly.
When the question is answered correctly,
the GameMaster should say “Correct!” and
the corresponding group of trashes should
disappear. But when the question is
answered incorrectly, the GameMaster
should say “Your answer is incorrect.” and
the trash should not disappear. When the
green flag is clicked once again, the

7/9
17/10/2017 Meeting 3
questionCount should be reset to 1 and the
trash sprites should appear again.

Common questions

Powered by AI

In the Scratch project, a variable named questionCount is created to manage the flow of questions. It is initialized to 1 whenever the green flag is clicked, ensuring a fresh start for counting questions. The variable is incremented by 1 after each question is processed, enabling the program to cycle through questions 1 to 4 before stopping .

Broadcast messages are directly linked to sprite groups by naming conventions that correspond with question answers. Each group of trash sprites (e.g., trash1.y) is programmed to respond to a specific broadcast message triggered by the GameMaster (e.g., removeTrash1). When the appropriate message is received, the designated sprite group uses the Look block to execute hide, effectively removing themselves from the stage .

Broadcasting in the Scratch project serves to synchronize and trigger events in response to specific conditions. For each correct answer, the GameMaster broadcasts a unique message (e.g., removeTrash1), which is received by specific groups of trash sprites, prompting them to hide. This mechanism allows for coordinated and conditional actions based on game state changes .

To reset the visibility of all trash sprites at the start of a new game session, a block sequence is added to each trash sprite that contains a when green flag clicked followed by a show block. This ensures that when the green flag is clicked, all trash sprites are made visible again, resetting their state for the new session .

To open and set up the 'Do the Math' project in Scratch, start by opening the Scratch application and download the file Do the Math.zip from the Downloadables section. Extract the file to reveal a folder named Do the Math. Open Scratch, click File ► Open in the Menu, navigate to the Do the Math folder, select the necessary project file, and click OK to open it .

The progression through different questions is controlled by a variable called questionCount, which initializes at 1 when the green flag is clicked. A loop with a condition that tests if questionCount is greater than 0 and less than 5 is used to iterate through the questions. After each question, the questionCount is incremented by 1 to move to the next question .

Upon correctly answering a question, the GameMaster sprite uses a broadcast block to send a message specific to the question (e.g., removeTrash1 for the first question). This message is received by the corresponding group of trash sprites, triggering them to execute the Looks block hide, making those sprites disappear from the stage .

The feedback mechanism involves visual and timing responses using the Looks block. For a correct answer, the GameMaster says 'Correct!' for 2 seconds and triggers a broadcast message after 0.5 seconds to remove corresponding trash. For incorrect answers, the message 'Your answer is incorrect' is displayed for 2 seconds with no further actions triggered, highlighting the feedback loop dependence on conditional checks .

User input is handled by Sensing blocks, which ask specific mathematical questions and wait for input. The responses are checked using If else statements where each If condition tests if the answer is correct. Correct inputs trigger a 'Correct' message and corresponding events (e.g., broadcasting to make trash disappear); incorrect inputs prompt 'Your answer is incorrect' without triggering any broadcast .

The GameMaster uses an If else block to evaluate user inputs against the correct answer for each question. For every question, a specific condition (e.g., answer=100 for the first question) is set within the If block. If the user's input matches the condition, the GameMaster uses the Looks block say [ ] to display 'Correct'. If the condition is not met, the else statement prompts the Looks block to say 'Your answer is incorrect' .

You might also like