Discuss Scratch

CodingClubH
Scratcher
1 post

Scratch Codingclub Example scripts

Score or Money

when flag clicked
forever


if <key [r v] pressed?> then
change [score v] by (1)

moving with arrow keys

forever
if <key [right v] pressed?> then
change x by (10)
end
end

question
as
ask [whats 1+1] and wait
if <(answer) = [2]> then
say [correct] for (2) secs
else
say [incorrect] for (2) secs
end

more blocks
define move
move (10) steps

move
Studio04040807
Scratcher
100+ posts

Scratch Codingclub Example scripts

You should describe variables more. Variables are able to store any line of text, such as “I like cheese.” To make a variable, go to the orange ‘Variables’ tab and click “Create a variable”. You can then use
 set [variable v] to [I like cheese] 
to directly change a variable, and
 change [cheese v] by (1) 
to add to a number variable.
deck26
Scratcher
1000+ posts

Scratch Codingclub Example scripts

This forum isn't the best place for tutorial topics. Creating a shared project with the appropriate scripts is more effective. Then if someone asks a relevant question in a new topic (the way the forum works best!) you can refer to the project. Tutorial topics and topics which try to emulate the forum pop up all the time and then disappear down the list.
Studio04040807
Scratcher
100+ posts

Scratch Codingclub Example scripts

Coding club lesson #1:Blocks
Scratch is a drag-and-drop programming language, where you can drag and drop ‘blocks’ to make code.
There are three main types of blocks:
move (10) steps // Stack blocks, which run code.
((1)+(1)) // Reporter blocks, which can be dragged into white inputs in other blocks. Reporter blocks represent a number or string.
<[cheese]=[cheese]> // Boolean blocks, which can fit into boolean inputs.
String inputs accept text, reporters, and Booleans:[String input]::control
Number inputs accept numbers, reporters, and booleans. (42)::control
A Boolean input only accepts booleans. <> ::control
End of lesson.

Last edited by Studio04040807 (Nov. 9, 2016 21:02:47)

Studio04040807
Scratcher
100+ posts

Scratch Codingclub Example scripts

Coding Club lesson #2: Event blocks
A simple program in Scratch has two main parts:
When gf clicked // An Event block at the beginning,
say [I like cheese.] // Stack blocks underneath.
Event blocks are a type of stack block because they attach onto stack blocks and run code.
Code in Scratch always runs from top to bottom:
when this sprite clicked //This runs first.
change [cheese v]by (1) //Then this,
go to x: (pick random (-240) to (240)) y: (pick random (-180) to (180)) //Lastly, this.

There are 8 blocks in the ‘Events’ category:
when green flag clicked //There is a green flag in the Scratch editor that looks exactly like the one on the block. Clicking it triggers this block.
when [cheese v] key pressed //Triggers when your computer thinks a certain key is being pressed. Choose which key with the menu.
when this sprite clicked //Triggers when a sprite is clicked. More on sprites in a later lesson.
when backdrop switches to [cheese v] //Triggers when the background changes. Not in the 1.4 editor.
when [timer v] > (10) //Triggers when one of the three menu items is higher than the number input. Not in the 1.4 editor.
when I receive [cheese v] //Triggers when a broadcast chosen from the menu is received.

broadcast [cheese v] //Broadcasts, which is sending a message, to all sprites in the project and the stage.
broadcast [cheese v] and wait //Broadcasts the message, then waits for all scripts that start with the "when [the same broadcast] received" block to run before continuing.
End of lesson.

Last edited by Studio04040807 (Nov. 9, 2016 21:03:34)

Studio04040807
Scratcher
100+ posts

Scratch Codingclub Example scripts

deck26 wrote:

This forum isn't the best place for tutorial topics. Creating a shared project with the appropriate scripts is more effective. Then if someone asks a relevant question in a new topic (the way the forum works best!) you can refer to the project. Tutorial topics and topics which try to emulate the forum pop up all the time and then disappear down the list.
This is the forum for a coding club that my friend @cooocoo333 made in real life. He is trying to teach coding using Scratch, and decided to use the Scratch Forums to provide example scripts. He's letting me put up posts for the club as well.
Th3_C0d3r
Scratcher
100+ posts

Scratch Codingclub Example scripts

Studio04040807 wrote:

This is the forum for a coding club that my friend @cooocoo333 made in real life. He is trying to teach coding using Scratch, and decided to use the Scratch Forums to provide example scripts. He's letting me put up posts for the club as well.
Were glad that your sooo willing to help, however what deck26 said is right. READ

This forum is design for people who need help to come forward and post their own topics. Not for tutorials. Tutorials/classes are probably best in separate projects or mabye? Show and Tell. These kinds of threads just push down others who actually need help and add unnecessary clutter that few will benefit from.
Studio04040807
Scratcher
100+ posts

Scratch Codingclub Example scripts

Coding club lesson #3: Sprites and Sprite subsubjects
A sprite is a part of the Scratch interface. Each sprite looks different, has different code, and has different sounds.
The default Scratch interface comes with one sprite, Sprite1. It looks like Scratch's mascot, the Scratch Cat, and has two costumes, one sound, and no scripts.

A costume is a part of the Scratch interface. It is part of a sprite. Each sprite has at least one costume. Costumes are images that can be edited using Scratch's costume editor. To access the editor, click the ‘Costumes’ tab, between the ‘Scripts’ tab and the ‘Sounds’ tab.
In Scratch 2.0, clicking the thumbnail of a costume opens the editor for that costume automatically. In 1.4, click the ‘Edit’ button next to the costume.
The costume shown on the Viewer can be changed using the
switch costume to [cheese v]
block.

A sound is part of the Scratch interface. Sprites can have any number of sounds. Click the ‘Sound’ tab to access a list of sounds. If your computer has a microphone, you can use the ‘Record sound’ button to record a new sound. You can also import sound files from your computer. Sound playing can be manipulated with the following blocks:
play sound [cheese v] // Starts the sound, then continues down the script.
play sound [cheese v] until done // Starts the sound, waits until it's finished, then continues down the script.
stop all sounds

A script is yet another part of the Scratch interface. Scripts are the main part of a Scratch project that make them interesting. The blocks discussed in lessons 1 and 2 are parts of scripts.
End of lesson.

Last edited by Studio04040807 (Nov. 9, 2016 22:41:37)

Studio04040807
Scratcher
100+ posts

Scratch Codingclub Example scripts

Th3_C0d3r wrote:

Studio04040807 wrote:

This is the forum for a coding club that my friend @cooocoo333 made in real life. He is trying to teach coding using Scratch, and decided to use the Scratch Forums to provide example scripts. He's letting me put up posts for the club as well.
Were glad that your sooo willing to help, however what deck26 said is right. READ

This forum is design for people who need help to come forward and post their own topics. Not for tutorials. Tutorials/classes are probably best in separate projects or mabye? Show and Tell. These kinds of threads just push down others who actually need help and add unnecessary clutter that few will benefit from.
Thank you for pointing that out, but you should contact @coocoo333 about it. He chose where to put the topic, and made the CodingClubH account for his coding students to share.
deck26
Scratcher
1000+ posts

Scratch Codingclub Example scripts

Studio04040807 wrote:

Th3_C0d3r wrote:

Studio04040807 wrote:

This is the forum for a coding club that my friend @cooocoo333 made in real life. He is trying to teach coding using Scratch, and decided to use the Scratch Forums to provide example scripts. He's letting me put up posts for the club as well.
Were glad that your sooo willing to help, however what deck26 said is right. READ

This forum is design for people who need help to come forward and post their own topics. Not for tutorials. Tutorials/classes are probably best in separate projects or mabye? Show and Tell. These kinds of threads just push down others who actually need help and add unnecessary clutter that few will benefit from.
Thank you for pointing that out, but you should contact @coocoo333 about it. He chose where to put the topic, and made the CodingClubH account for his coding students to share.
What does sharing the account have to do with posting in the wrong place? Whoever is posting here is the person we need to convince they are probably wasting their time. In a month this topic will probably be several pages down the forum and never looked at again. If someone is putting in this effort they presumably want it to last longer than that so posting in the right place or creating projects instead of a forum topic would make much more sense.
coocoo333
Scratcher
94 posts

Scratch Codingclub Example scripts

woops sorry I have not been in scratch for a while looks like I am getting allot of complaints

I am so sorry I guess I miss judged where to put the topic

any ways I will move it
coocoo333
Scratcher
94 posts

Scratch Codingclub Example scripts

deck26 wrote:

Studio04040807 wrote:

Th3_C0d3r wrote:

Studio04040807 wrote:

This is the forum for a coding club that my friend @cooocoo333 made in real life. He is trying to teach coding using Scratch, and decided to use the Scratch Forums to provide example scripts. He's letting me put up posts for the club as well.
Were glad that your sooo willing to help, however what deck26 said is right. READ

This forum is design for people who need help to come forward and post their own topics. Not for tutorials. Tutorials/classes are probably best in separate projects or mabye? Show and Tell. These kinds of threads just push down others who actually need help and add unnecessary clutter that few will benefit from.
Thank you for pointing that out, but you should contact @coocoo333 about it. He chose where to put the topic, and made the CodingClubH account for his coding students to share.
What does sharing the account have to do with posting in the wrong place? Whoever is posting here is the person we need to convince they are probably wasting their time. In a month this topic will probably be several pages down the forum and never looked at again. If someone is putting in this effort they presumably want it to last longer than that so posting in the right place or creating projects instead of a forum topic would make much more sense.

it does not matter I put the URL on the board in meetings of the topic discussion

Powered by DjangoBB