Scratch Program - Jump Jump
I created the above program to introduce Scratch Programming to by Blog Readers. It is a simple program. When you press the Green flag, the letters of the word SCRATCH start jumping with a musical sound. They will stop if you press the Red button. And the letters Reset to original location if you press Spacebar.
The good thing about Scratch is that you can share a program once you have created and saved it. And you can also look at the programming involved in that program too.
Now the link to the above program is given below.
There is a button named "See Inside" at the top right corner of the Window, that will open the Scratch Editor which will show you the coding of this program.
Each sprite in scratch needs to be coded individually I will add a few notes below to make it easy to navigate around the Scratch Editor.
- You need to select each Letter/ sprite separately from the Scratch library one at a time.
- You need to select the sprite when you are coding for it.
- You can copy the code from one sprite to another. First select the code block that you want to copy to another sprite. Drag the code block to the thumbnail below the stage area. Drop the code block over the sprite that you want it to copy to. Now if you select that sprite you should see the code block copied.
- When you place a sprite anywhere in the stage area, its location co-ordinates are automatically added to the code blocks of the Script area. Therefore if you need to have a code block that shows the current co-ordinates, they are already added to that block in the Scripts tab. That should make your job easier.
- Select appropriate sound from the Sound library from the Sound tab adjacent to the Scripts tab.
- I intended to add sound to each of the sprite separately, but I found out that somehow it did not work. The sound was played only once, therefore I added a loop in the first sprite, that solved the sound issue and added an unexpected twist to the program. I am unable to explain how this works in sprite.
- I have used the Press Green Flag as the starting event, and the Red button to stop the program.
- I had to create Reset code to bring the jumping blocks to Original position. I have used Spacebar to initiate Reset code.
- You have to add the Reset code to each of the sprites.
- When one sprite's code is executed, it can broadcast a message. You can name these messages by selecting Events > Broadcast > New message. I have used the name of the next sprite/ letter to make it easy to associate.
- When the next sprite receives the message broadcast by previous sprite using Events > When I Receive block, it can execute another set of code. At the end of the code, this sprite will broadcast a new message which can be received by the next sprite. That is how I have created the sequential execution of codes for the different letters.
- The loop in the first sprite is an unintended twist. It has produced some unexpected results which I am unable to explain.