Project 5 (Scratch Programming) – Week 1 (Day 1), – Duplicating a Sample Game

So today was the start of our new project. We delved into the world of Scratch Programming. Basically, it’s a program for making games and stuff like that.

It uses blocks with words on them, like this:

Outlook of scratch blocks

There are a list of different blocks that you connect to each other to create “scripts” for an object (basically, these are commands that you use to program the different parts of scratch, like stages, sprites [or characters] etc.).

In my opinion, this makes Scratch a lot easier to work with (the words on it are sometimes really simple, and already tell you what its function is).

Basically, our task today was to follow a set of instructions to duplicate a simple game of a shark chasing yellow fish (and gaining points after eating them), while avoiding the red fish (which causes you to lose points after eating them).

Here’s a list of some of the main programming we had to do for the game:

  • we had to program the shark sprite to follow the cursor
  • we had to make it so that the yellow and red fish would spawn (appear) randomly at different areas of the side of the screen, and they had to re-spawn randomly
  • we had to program the shark to change color and change into a costume (a different look) when it touched the yellow fish, and turn a different color and costume when it touched a red fish (basically, we had to change its appearance)
  • we had to program the two fishes to disappear after being “eaten” (after touching) the shark
  • we had to program the game to keep track of a score (caused by eating the fish)

So here is a list of different concepts in Scratch. I may add to the original explanation to simplify/suit the game’s explanation, or just to show my own interpretation, which may not be simpler (my additions will be shown in italics and bold, so as to be able to differentiate the two explanations). I will also add in a screen shot of an example (the following table has been copied off a document). Some of these concepts may not have been used in the fish game, but I will still attempt to explain them in my own way (they will retain their original example screen shots).




sequence To create a program in Scratch, you need to think systematically about the order of steps.This is basically what it means, a sequence. When you are making scripts, you have to be careful about the order of the blocks, as they will be important in how an object is programmed. A sequence is basically a list of blocks stacked in a certain order for something specific to happen.  I’m not too sure if there were any sequences in the fish game (because I think a lot of the orders of certain scripts were interchangeable). So as I don’t think it was used/I do not want to to not run the risk of giving a wrong example, I will retain the original example.

Sequence example

So for this example, the sequence is in a certain order for the script to work appropriately. When the space key is pressed, the sprite will go to the coordinates x=-100 and y=-100. After that, it will glide for 2 seconds to the coordinates stated, and then it will say let the show begin for 2 seconds, and then a fanfare sound will play. It can’t very well play the sound first, and then say the let the show begin, and then glide. This is why the order is important.

iteration(looping) forever and repeatcan be used for iteration (repeating a series of instructions)This is basically a script used to make something happen repeatedly, or to make something happen without an end.

Repeat and Forever

In this example, repeat is used to create the blinking effect of the shark when it eats the fish. The color and look of the shark is changed repeatedly to create animation.

The forever is used so that the shark will always follow the mouse pointer.

conditional statements if and if-elsecheck for a condition.This reminds me a lot of our excel project. It’s basically what its literal meaning is. “If” means if a requirement is filled, then something will happen (you can set what that something is). “If else” is basically the same as if, but there’s an else. The else means that if the requirement of if is not fulfilled, then something will happen.

If and If-else

The above example as used for the movement of the yellow fish. It means that if the requirement of if was fulfilled, then the sprite would go the the coordinates stated in the blue blocks. Else means that if “If” was not fulfilled then the coordinates in the blue blocks below else would be applied to the fish.

variables The Variables category allows you to create a new variable and use it in a program.Scratch supports both global and object-specific variables.This is basically something that you can set for different purposes. It is basically, a variable. It can change depending on what you set for it. It can be used to calculate in-game scores, distances, etc.


So for the fish game, a variable (which was named score, for the purpose of, obviously, keeping track of the score) would be set to 0 at the start of the game. Then (as seen by the screen shot above), if the yellow fish touched the shark, it would change the score by 1 (meaning you would get one point). THis way, you could keep scoring and be able to tally it up.

(parallel execution)
Launching two stacks at the same time creates two independent threads that execute in parallel.I’m not quite sure how this is that different from normal scripts to the point that it earns a separate term, but the best I can figure is this means when you have two scripts that are executed at the same time.  I’m not too sure if there were any threads in the fish game (as all of the scripts were mostly in one set, with the exception of different scripts for different broadcasts). So as I don’t think it was used/I do not want to to not run the risk of giving a wrong example, I will retain the original example.ThreadsSo in the example above, when the green flag (the start button, essentially) is clicked, both of the scripts will be executed at the same time.
synchronization broadcast can coordinate the actions of multiple sprites.This was really useful. Basically, it sends out a signal to the program, and then depending on the signal, you set sprites and stages to react in different ways.


Basically, as explained above, it “broadcasts” a message to the program and you can set multiple things to react differently based on the signal being broadcast.

real-time interaction mouse_x, mouse_y, and loudness can be used as dynamic input for real-time interactionI think this is just basically when you set things to happen constantly. Not sure how to classify this.  I’m not too sure if there were any real time interactions (unless you count the shark  moving) in the fish game, so as I don’t think it was used/I do not want to to not run the risk of giving a wrong example, I will retain the original example.

Real time interaction

So this is basically a script for the loudness to be set at 4% throughout the game. It’s used for things like loudness. Still not really sure how t explain it.

boolean logic and, or, notare examples of boolean logic.This basically is used when you want to make something happen for more than one thing (e.g adding a requirement for IFS) (or, and), or if you want to to say if something is not fulfilled (not sure about boolean logic, truthfully. Haven’t used it).  I don’t think there was any boolean logic in the fish game, as I didn’t use any of the and, or, or notoperator blocks. So as I don’t think it was used/I do not want to to not run the risk of giving a wrong example, I will retain the original example.

Boolean Logic

So this basically means that only if both requirements are fulfilled (the sprite is touching that color, and the x coordinates of the sprite are 200), will the program play the sound “music” and change the score by 1.

random numbers The pick randomblock selects random integers within a given range.This basically is a block that will set the program to pick random numbers (from a set of numbers given). This is done to make the game more unpredictable and make it seem more like a game. Refer to example —>

Random Numbers

This was used to make the movement of the fish random and unexpected. In the example above, the script basically means:

go to x -240 y: pick random -190 to 190 – when it says x and y, it is referring to the coordinates (as in things like the x  and y axis), so it means that the sprite will appear on the left edge of the screen, and will appear randomly in the y axis (basically the vertical coordinates at which it spawns will be random) between the coordinates -190 and 190 (top to bottom).

event handling when key pressed and when sprite clicked are examples of event handling – responding to events triggered by the user or another part of the programThis is basically when a user or another part of the program executes something, and you can format certain things to react based on what was executed,   I’ll use the original example, just in case:

Event Handling

This basically means that if the left arrow key was pressed, then the sprite would point in the direction of -90 and bove 10 steps that way.

user interface design You can design interactive user interfaces in Scratch – for example, using clickable sprites to create buttons.This is basically programming a sprite to interact with the user. For example, by making it clickable and making something happen after clicking it. It’s similar to event handling.  I don’t think I used this for the fish game, so I’ll just use the original example:This example basically programs the sprite so that when it is clicked, the look (brightness) of the sprite changes, and a sound plays.

So that’s about my understanding of it. That was a fairly annoying table. Anyway, next lesson I start with planning and creating the project.


When I checked my blog, I found out that part of the table was cut off due to it being to large. After more than half an hour of trying to fix this, I finally had to change my theme (previously the notepad) into the current one so that the table will fit. From now on, there shouldn’t be any problems with formatting and the fitting of posts/images.

About jaoj2

Sha Tin College 10S
This entry was posted in Project 5 - Scratch Programming, Projects, What I Did Today. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s