0% found this document useful (0 votes)
8 views2 pages

Gr5 T3 Code - Org Notes

Code.org's Code Studio is a platform for learning basic coding and computer science concepts, including algorithms, functions, debugging, and programming. The document provides step-by-step instructions and code examples for creating two games: Tic Tac Toe and Cookie Clicker. Each game includes design steps and specific code blocks to implement the functionality.
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)
8 views2 pages

Gr5 T3 Code - Org Notes

Code.org's Code Studio is a platform for learning basic coding and computer science concepts, including algorithms, functions, debugging, and programming. The document provides step-by-step instructions and code examples for creating two games: Tic Tac Toe and Cookie Clicker. Each game includes design steps and specific code blocks to implement the functionality.
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
You are on page 1/ 2

Grade 5

Code.org

What is Code.org?

Code Studio is a fun, creative platform for learning basic coding and
computer science.

1. A set of step-by-step instructions for problem-solving is called an


algorithm.
2. A piece of code that can be called over and over is called a function.
3. Finding and fixing an error in the program is called debugging.
4. One or more commands to be carried out by a computer is called code.
5. Coding is a series of commands that tells the computer what to do.
6. The art of creating a program is called programming.
7. A bug is a coding error in a computer program.

1. Code for Tic Tac Toe:


Design steps:
1. Insert an image from the design tool.
2. Select a square shape image.
3. Change the color and size of the shape.
4. Now, duplicate the same shape 8 times and rename them as “button1 to
button9”
5. Add the title of the game
6. Add “button” and change the name to “xturnbutton”
7. Add “button” again and change the name to “oturnbutton”
8. Now, click on the code tab
9. Click and drag the below code blocks
10. Run the program.

Code:
var icon = "icon://fa-times";
onEvent("xTurnButton", "click", function( ) {
icon = "icon://fa-times";
});
onEvent("oTurnButton", "click", function( ) {
icon = "icon://fa-circle-o";
});
onEvent("button1", "click", function( ) {
setImageURL("button1", icon);
});
onEvent("button2", "click", function( ) {
setImageURL("button2", icon);
});
onEvent("button3", "click", function( ) {
setImageURL("button3", icon);

1
});
onEvent("button4", "click", function( ) {
setImageURL("button4", icon);
});
onEvent("button5", "click", function( ) {
setImageURL("button5", icon);
});
onEvent("button6", "click", function( ) {
setImageURL("button6", icon);
});
onEvent("button7", "click", function( ) {
setImageURL("button7", icon);
});
onEvent("button8", "click", function( ) {
setImageURL("button8", icon);
});
onEvent("button9", "click", function( ) {
setImageURL("button9", icon);
});

2. Code for Cookie Clicker:


Design steps:
1. Insert an image from the design tool.
2. Select a cookie image(jpg file) from the browser and save it on your
desktop.
3. Click on “my files” and then click on the file upload button and select the
cookie image.
4. Give the id name of the cookie image to “imgcookie”.
5. Add the title of the game “Cookie Clicker” by dragging “abc label”
6. Add the “score: 0” by dragging “abc label” and id should be "lblscore".
7. Drag the “button” from the design toolbox and rename it into “RESET”
under text and ID should be "btnreset".
8. Now, click on the code tab
9. Click and drag the below code blocks
10. Run the program.

Code:
var score = 0;
onEvent("imgcookie", "click", function( ) {
score = score+1;
setProperty("lblscore", "text", "score: " + score);
playSound("sound://category_alerts/retro_game_alert_2.mp3", false);
});
onEvent("btnreset", "click", function( ) {
score = 0;
setProperty("lblscore", "text", "score: " + score);
});

You might also like