This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-07-05 09:19:50

maail
Scratcher
Registered: 2009-04-02
Posts: 1000+

Maail's tutorial to Scratch

Version 1.4


Have you ever wanted to make cool games on scratch??Well this tutorial will show you how!

CONTENTS
-Basic Animation
-Looks and Effects
-Loops,Booleans
-Math and Numbers
-Controlling
-Sounds
-Pen
-Variables and Lists
-Scratch Board


Chapter 1 - Basic Animation


So..you want to make your own projects on Scratch?

Lets start with movement;that's really simple

Open Scratch,you will see a cat.This cat is the Scratch mascot.Now let's give him some movement

http://i45.tinypic.com/2eo86k8.gif
Copy this script into the cat.

Now click the green flag!The cat moved!!

How did it happen?

First the yellow block http://i45.tinypic.com/j79klf.gif means that the following actions will happen when the flag is clicked.Then the http://i45.tinypic.com/20f6rkj.gif makes sure the cat goes to his original position before running.You can change that to any other coordinate.Finally the http://i50.tinypic.com/2dgokli.gif block tells the cat to move smoothly to that position.

Lets try some thing harder http://i48.tinypic.com/2rptxc7.gif http://i46.tinypic.com/ofr33q.gif http://i46.tinypic.com/oazt5g.gif.Now click the green flag and try pressing the left or right keys.

The cat moves when you decide to!Awesome!!

How did it work?

First,he comes to the center,just like he did on our first script.http://i.imgur.com/y5QJ3.jpg means that the actions connected will execute when a certain key is pressed.The http://i.imgur.com/eKMdV.jpg block changes the x coordinate of that sprite.

Always remember this:
-ALL scripts start with a ''hat'' block such as the ones used above
-If you but a negative number on ''change x by'' blocks he will go backwards

Time for something funner

Copy this script into the cat
http://i.imgur.com/crk6b.jpg


Press the green flag and use left or right keys.So,what happened?

The cat rotates as he moves!Fun eh?

First he comes to the center and point to the direction right.The ''turn ## degrees'' comes in two directions.We used both on this script.Also the ''move ## steps'' moves the sprite as well but only in the direction he is pointing to!

Remember the directions:
0:up
90:right
270(-90 in Scratch):left
180:down


Chapter 2 - Looks and Effects


In this chapter we will learn about the ''looks'' in Scratch Blocks

http://i.imgur.com/G123r.jpg

Copy this into the cat.Now click the green flag and press the space bar a few times.Whoa!!The colors changed!!Magic??Yes,programing magic!How?

First,the script removes all the graphic effects.Then,when you press the Space Bar,the color effect is changed by 25.

Try changing that to other effect, such as Whirl,or Ghost.

There's a list of Scratch's effect blocks:
-Color
-Fisheye(makes center of sprite bigger)
-Whirl
-Pixelate
-Mosaic
-Brightness
-Ghost(transparesy)

http://i.imgur.com/aiFSr.jpg

These blocks can be used to change costumes,or for dialogs.

http://i.imgur.com/NMnFL.jpg

Try copying this script and running it.Then press space some times.

Now he moves really well.How did that happen?

First,it comes to the center, and it changes to it's first costume.Then he salutes us, and tells us how to move him

Then,when space is pressed, the costume changes, and he moves to the right.

http://i.imgur.com/d1RQT.jpg

The first three blocks, can be used to change a sprite's size. This, along with layering (look below), is often used to create the illusion of the so-called ''3D Games'' (yup, just a illusion. 3D is not supported by Scratch..sorry).The last two blocks are simple,but really useful: They show or hide a sprite. This is good for, say, when you want a certain sprite to appear after something happens.When a sprite is hidden, it can't execute ''When clicked'' commands.

http://i.imgur.com/fCtTM.jpg

These two blocks are used for layering.What's that, you ask?

When you use ''go to front'' , the sprite shows in front of all sprites.When you use ''go back [#] layers'' , he goes below the sprites. So layering, involves the order in which the sprites show up.

Chapter 3 - Loops, Booleans

On this chapter we will cover Loops, and most of the Sensing blocks.

A loop on Scratch ( and other programming languages ) is a series of commands that repeat.

Let's try a simple loop:

http://i.imgur.com/PLOa4.jpg

Whoa, that's nice!!There are 4 kinds of loops:
Forever
Repeat [#]
Forever if
Repeat Until
On this one we used Forever.

Forever repeats something forever:Since it starts until you press the red Stop button, or use a stop all block.

Forever if repeats something only if a boolean (see chapter 2) is true.Repeat until is the opposite, it repeats something until a boolean is true. Repeat [#] repeats something the times you specify.

A boolean (or bool) is a true/false value.

If you go to the ''Sensing'' section, you'll find lots of boolean to use.

Remember our first movement script on Chapter 1?...Let's improve it.

http://i28.tinypic.com/2w1ut7s.gif
(please note that this is a image because i could not code the scrip using the blocks given on the forums)

This is a smoother version. You should use this one.

Okay. So, loops that require booleans work when the booleans is true.

But.. what if I want it to run when it's false? Simple. Go to the numbers section and use the ''Not'' block. You'll also find a ''And'' ( two booleans need to be true) and ''Or'' (two possibilities)

Remember, the type of blocks in Scratch is defined by their shape:
-Hat blocks: They start it all
-Normal: Command
-Diamond: Boolean
-Round: Number
-C: Loop

Chapter 4 - Math and Numbers

Math? You hate math!!? I know I do too, but if you do close this you will regret it.  wink

Math is a basic component of Scratch projects. Many great projects, even some of the simple ones need a mathematical formula.

Example: Let's say you want to calculate the score, using the enemies killed AND the time left ( okay, that does involve variables, we'll see them in an other chapter)

There. This script, when the game's over, calculates the score multiplying the Time Left by the Enemies Killed.

http://imgur.com/wJvPN.gif

And divides the result by 2. Here we got a formula.
Go to the ''Numbers'' section, you'll find lots of math blocks.

These are the basic Math blocks:

http://i.imgur.com/acoiy.jpg

If you already took 4th grade, you should obviously know the first four.
The 5th one picks a number at random. Good for chance games.

http://i.imgur.com/KHOkK.jpg

These are also a it obvious: Smaller then, Equal to,Greater then.

These (ones below) aren't really ''Math'', but they're still good for our formulas, as they can change the sense of a script.

http://i.imgur.com/PCA4R.jpg

Below are some more complex blocks.

http://i.imgur.com/qSe8q.jpg

Honestly, I do not know much about these, but subzerostig told me about a few!

Abs means absolute value, and turns all numbers into a positive one.

-7 turns to 7 & 7 turns to 7

The round function rounds the number to the nearest 1.

2.5=3
2.49=2
3.9=4
3.1=3

That's quite simple.

The mod function mod gives the remainder of a number.

6 mod 4 = 2
13 mod 6 = 1
4 mod 2 = 0

e^'s official term is the base of natural logarithms. You can use it to tell how something grows.
e^ means e to the power of ()
e roughly equals 2.7 so e^ of 2 means 2.7*2.7 e^ means 2.7*2.7*2.7
However, e^ can be a decimal.
You can use it in advanced formula's to work out how your money grows.
You would use this formula:
pert

If you want to find out more about the others, then ask a few people and see if they know!

Chapter 5 - Controlling

This time we will cover the ''Control'' section. They're the key to have a good game, of course, along with many more aspects of Scratch.

Go to the Control category, and create another sprite, we'll use it later

Broadcasts are essential for good games. How do they work? Basically, a sprite sends a message to another, and the other executes a script.

Now, put this script on the first sprite:
http://imgur.com/Dpw8o.gif

And this one on the second:
http://imgur.com/DWPBa.gif

Now click the green flag. If Sprite2 said ''Received!'', you did it well. Congratulations!

The ''broadcast [---] and wait'' broadcast a message, and any command after the block will execute once all block receive the broadcast.

http://imgur.com/NjjUH.gif

These two blocks can be used to end scripts. The first ends the current script, while the second stops everything.

http://imgur.com/N1CRJ.gif

Try this script, and run it. The sprite will constantly change it's colors, until you press Space, to stop all scripts.

http://imgur.com/eJWZX.gif

These blocks allow you to wait between two commands. The first, ''wait [#] secs'' waits the amount of seconds you specify before executing other commander. The second, waits until a boolean is true before executing other commands.

Chapter 6 - Sounds

Sounds are an important part of Scratch projects; they brink it to life(not really  tongue ). On this chapter we'll learn how to give or projects sound.

Select a sprite, and click on the Sounds tab. You'll see all the sprite's sounds. By default, the Scratch Cat sprite includes only one sound: ''meow''. Try playing it with the play button. You'll hear a cats meow. Now, lets play it with a script.

http://imgur.com/u41JN.gif

The ''play sound'' block plays the sound you select. ''Play sound until done'' play it as well, but before executing any block after it, the sound must finish.

''Stop all sounds'' is self-explanatory  tongue

You'll find some MIDI blocks as well.

http://imgur.com/d8o9v.gif

The first block plays a drum. MIDI drums are numbered from 35 to 81. The second is like a wait block, but using beats rather than seconds. The third plays a MIDI note, from 0 to 127, but a good range is from 48 to 72; about 2 octaves. The last sets the instrument for the ''play note'' block to use. There are 128 instruments. That sounds like a lot  tongue

Try composing a simple melody with the blocks. Here's a simple beat I made, below

http://imgur.com/gjxTP.gif

http://imgur.com/JJsSv.gif

The first two blocks change the volume of the project. 100 is the maximum volume. The last two change the tempo of the MIDI blocks. The tempo is measured in beats per minute (bpm, DUH  tongue ). So, a tempo of 60 means every beat dures 1 second.

Chapter 7 - Pen

Pens aren't usually used on projects, but they're good for Paint Programs(Yep you can make these on Scratch  tongue ).

On this chapter we'll cover the Pen section and it's blocks.

Copy this script:

http://imgur.com/8JfF4.gif

Use any color you want. Press the green flag, then, move and click your mouse.

You just made a cool pen script  smile  It's perfect for Paint Projects. How did it work?

First it clears everything you drew. Then it always goes to the mouse, and if you click the mouse the pen is Down (It draws  tongue ), but Otherwise, it's Up (It does not draw).

But remember, each sprite has it's own pen, and it's own pen color, size, etc.

So if you wanted, a sprite that when clicked gives another color, you'd have to use broadcasts.

You can make it so the computer draws a picture by itself.

Let's try drawing a square using this script, then run it.

http://imgur.com/tdZGC.gif
It drew a square. But wait, you can make it faster. Try changing the seconds.

There's another simple programming language which has a really powerful pen as well. It's called Logo, you might want to try it.

Here's the Logo interpreter

Chapter 8 - Variables and Lists

Variables are essential part for good projects. Lists are really useful in some.

A variable, as their name indicates, is something that varies. It can be anything, the score, the lives, ammo, costume numbe, or anything else. That is, if you use the script well. Try going to the Variables category, and create a variable called ''costume''. There are two types of variables: ''For all sprites'' and ''For this sprite only''. Pick the first one.

On the Stage, use this script:

http://imgur.com/Gmk8O.gif

On Sprite 1, use this script:

http://imgur.com/HL2Ej.gif

Then run it. If you did it well, Sprite 1 will constantly change it's costume.

List are in the same category. Basically, a list is a group of variales. You can use it for whatever you want, as well.

Let's say you want to use it as a Inventory, and want to check if the first item is ''Key''. Use this:

http://imgur.com/hRo10.gif

The only way for Scrath to handle strings (lines of letters) is using another variable, and setting it to a string.

But, what if you want to check every single item? Use this:

http://imgur.com/FcAjB.gif

(set[action?] to [1] isn't really necessary, the broadcast is enough)

Chapter 9- Scratch Board

First off, sorry for the years worth of delay, I got lazy  tongue

Second off, if you don't own a Scratch Board (or PicoBoar, both are the same), you'll not be able to test out scripts on this Chapter.

I own one, but I bearly ever use it so I'll try to be as precise as possible on this.

Look at these blocks on the Sensing category:
http://i.imgur.com/2vyjy.gif

We got a variable and a boolean there.

The variable is used to check the value of a sensor. You'll ask: What? Well, the Scratch Board has a set of sensores used to connect Scratch to our world.

The Sensors used by the Board are....
http://i.imgur.com/xdlq3.png

1-Slider: A simple slider. It's value varies between 0 and 100 depending on the slider's position
2-Light: A light sensor. It's value is 0-100 depending on the light around the it. (0= dark room, 100= direct light.)
3-Sound: It works just like a mic, and therefore just like the ''Loundness'' block.
4-Resistance: There are 4 of them on the board. Each one is a cable with two metallic ends, when they touch, it gives a value. The harder you press, the higher value.

So, what's the boolean for? It has 2 options, checking if the button is pressed, or if a sensor is connected.

Here is a simple script to check if a sensor is connected.
http://i.imgur.com/vLEWD.gif

A Scratch/PicoBoard is a great way to interact with Scratch. Just imagine the possiblities! You could make a adventure game where you move using the slider, and use real light to lit up dark areas, or the button and the resistance sensors to interact with objects.

Also, a fun thing to do is creating custom sensors using these resistance sensors. You could make a cardboard gun using a resistance sensor as the trigger and the slider to aim. Or maybe a steering wheel, using two resistance sensors on the sides, with a system so when you steer the wheel, something activates the risist. Sensors (ex: a Strong piece of cardboard). You can make just about any sensor with the resistance sensors, as long as you have enough materials, and creativity.

If you're unsure of what a block does, right click it, and click on ''help'' to see a short definiton.

Well, this is the last chapter until 2.0 so I have to give credit where it is due; technoguyx for all the information  big_smile

Also sadly 1.4 will be the last version of this guide until Scratch 2.0 is out, other then the occasion when I find more on the only non complete chapter other then Scratch Board, Math and Numbers! Thanks for reading this!

Last edited by maail (2011-02-17 11:15:04)


http://i.imgur.com/uH8sS.png

Offline

 

#2 2010-07-05 09:24:07

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: Maail's tutorial to Scratch

Where's looks and effects? and this should go in all about scratch...


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#3 2010-07-05 09:41:42

illusionist
Retired Community Moderator
Registered: 2008-07-02
Posts: 1000+

Re: Maail's tutorial to Scratch

Moved to All About Scratch- for obvious reasons.  tongue


http://i.imgur.com/8LX1NrV.png

Offline

 

#4 2010-07-05 13:38:25

Cnor
Scratcher
Registered: 2010-01-29
Posts: 1000+

Re: Maail's tutorial to Scratch

nice, the first part is good and the other buts will hopefully be as well  smile


See that post up there ^^^
That post was done by me  wink

Offline

 

#5 2010-07-06 23:29:31

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Maail's tutorial to Scratch

Looks great so far! I hope this will help many new scratchers get started.  smile


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#6 2010-07-07 12:33:41

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Maail's tutorial to Scratch

maail wrote:

Oh good a mod changed the name just like i asked! thanks!!  big_smile

Why did you want it changed?

Offline

 

#7 2010-07-08 01:33:35

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Maail's tutorial to Scratch

I think to imitate the ITopic thing.  tongue


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#8 2010-07-08 04:58:06

Blade-Edge
Scratcher
Registered: 2009-06-13
Posts: 1000+

Re: Maail's tutorial to Scratch

Chrischb wrote:

I think to imitate the ITopic thing.  tongue

How so?

Also, great guide, but the blocks are really messed up for me. You should try using that function that lets you take pictures or Scripts, and put them up instead


http://img29.imageshack.us/img29/5145/scratchycat.gif CLASSY

Offline

 

#9 2010-07-08 05:10:14

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Maail's tutorial to Scratch

Blade-Edge wrote:

Chrischb wrote:

I think to imitate the ITopic thing.  tongue

How so?

The title was "I-Topic All About Scratch" earlier - it got changed back now...

Last edited by Chrischb (2010-07-08 05:10:37)


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#10 2010-07-08 05:16:20

Blade-Edge
Scratcher
Registered: 2009-06-13
Posts: 1000+

Re: Maail's tutorial to Scratch

Chrischb wrote:

Blade-Edge wrote:

Chrischb wrote:

I think to imitate the ITopic thing.  tongue

How so?

The title was "I-Topic All About Scratch" earlier - it got changed back now...

Okay then.
Have you answered my question about ITopics yet?


http://img29.imageshack.us/img29/5145/scratchycat.gif CLASSY

Offline

 

#11 2010-07-08 06:15:11

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Maail's tutorial to Scratch

Blade-Edge wrote:

Chrischb wrote:

Blade-Edge wrote:


How so?

The title was "I-Topic All About Scratch" earlier - it got changed back now...

Okay then.
Have you answered my question about ITopics yet?

What question?  hmm


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#12 2010-07-28 11:12:26

JeanTheFox
Scratcher
Registered: 2010-06-14
Posts: 1000+

Re: Maail's tutorial to Scratch

I think that this should be a permanent sticky, that's what I think.


http://i51.tinypic.com/20gcn5j.png

Offline

 

#13 2010-08-01 10:56:41

Wolfie1996
Retired Community Moderator
Registered: 2009-07-08
Posts: 1000+

Re: Maail's tutorial to Scratch

Ah - I think I can explain why the topic name hasn't been changed. Because "ITopic" is a special tag given to certain threads, we moderators have to discuss with each other and the Scratch Team before we put the tag on a topic title. This is a really nice guide though - perhaps when it's completely finished, we'll consider it for the ITopic tag  smile


"...Jargon - the practice of never calling a spade a spade, when you might instead call it a manual earth-restructing implement..." - Bill Bryson, Mother Tongue

Offline

 

#14 2010-08-02 08:01:27

maail
Scratcher
Registered: 2009-04-02
Posts: 1000+

Re: Maail's tutorial to Scratch

Wolfie1996 wrote:

Ah - I think I can explain why the topic name hasn't been changed. Because "ITopic" is a special tag given to certain threads, we moderators have to discuss with each other and the Scratch Team before we put the tag on a topic title. This is a really nice guide though - perhaps when it's completely finished, we'll consider it for the ITopic tag  smile

I see thanks for the help, Wolfie1996  smile


http://i.imgur.com/uH8sS.png

Offline

 

#15 2010-08-23 12:13:08

MasterOfDeception
Scratcher
Registered: 2009-12-29
Posts: 100+

Re: Maail's tutorial to Scratch

Awesome guide, If you finish it it should be stickyed!


"My Language Arts teacher beat Chuck Norris up." -12three

Offline

 

#16 2010-08-23 13:20:58

maail
Scratcher
Registered: 2009-04-02
Posts: 1000+

Re: Maail's tutorial to Scratch

MasterOfDeception wrote:

Awesome guide, If you finish it it should be stickyed!

It will be done in a while, just need some time  smile


http://i.imgur.com/uH8sS.png

Offline

 

#17 2010-08-23 13:33:42

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Maail's tutorial to Scratch

This guide is amazing !


Hai.

Offline

 

#18 2010-08-23 15:12:47

Lellowsfuzz
Scratcher
Registered: 2009-04-17
Posts: 500+

Re: Maail's tutorial to Scratch

Great! This wil help lots of new Scratchers! This is a great thing you are doing, maail.

Offline

 

#19 2010-08-25 04:54:21

maail
Scratcher
Registered: 2009-04-02
Posts: 1000+

Re: Maail's tutorial to Scratch

fg123 wrote:

This guide is amazing !

Thanks I worked really hard on this !

Lellowsfuzz wrote:

Great! This wil help lots of new Scratchers! This is a great thing you are doing, maail.

I take great pride  tongue


http://i.imgur.com/uH8sS.png

Offline

 

#20 2010-08-25 05:22:33

iCode-747
Scratcher
Registered: 2009-11-21
Posts: 1000+

Re: Maail's tutorial to Scratch

This should get stickied!  big_smile

EDIT: grammer error.  tongue

Last edited by iCode-747 (2010-08-25 05:24:45)


-End Transmission-

Offline

 

#21 2010-08-27 12:43:46

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Maail's tutorial to Scratch

big_smile  This is still awesome! I wish this was around when I registered.  big_smile


Hai.

Offline

 

#22 2010-08-28 07:21:03

maail
Scratcher
Registered: 2009-04-02
Posts: 1000+

Re: Maail's tutorial to Scratch

I think last part will be done uhh maybe some other day not today it has a lot of things on it so I can yet  tongue


http://i.imgur.com/uH8sS.png

Offline

 

#23 2010-08-28 07:44:50

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: Maail's tutorial to Scratch

I'll be sure to keep an eye on this.  big_smile


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#24 2010-08-28 07:59:15

maail
Scratcher
Registered: 2009-04-02
Posts: 1000+

Re: Maail's tutorial to Scratch

Chrischb wrote:

I'll be sure to keep an eye on this.  big_smile

Really, thanks, sadly the next upload may be a long time away but I am already started!  big_smile


http://i.imgur.com/uH8sS.png

Offline

 

#25 2010-08-28 18:03:35

iCode-747
Scratcher
Registered: 2009-11-21
Posts: 1000+

Re: Maail's tutorial to Scratch

maail wrote:

Chrischb wrote:

I'll be sure to keep an eye on this.  big_smile

Really, thanks, sadly the next upload may be a long time away but I am already started!  big_smile

yikes

Such courage! I could never follow through with this. Awesome!  big_smile


-End Transmission-

Offline

 

Board footer