Interesting programming exercises on Scratch for 2nd graders

Interesting programming exercises on Scratch for 2nd graders

Interesting programming exercises on Scratch for 2nd graders

Content Protection by DMCA.com

Scratch is a great program from MIT that can help kids in grades 2 through 5 learn programming. However, the program can be a bit confusing at first, so it’s helpful for kids to do simple projects as they get used to the platform. Therefore, this article has compiled some interesting Scratch exercises for children, helping them become proficient in using the software and ready to perform more advanced projects in the future.

Below are perfect Scratch exercises for beginners learning Scratch programming, most suitable for students in grades 2 to 5.

Make the cat fly towards the cursor

Project Scratch The first and simplest is to create an image of a cat hovering on the screen, following your mouse pointer.

Code screen on Scratch

The first step is to create a new project. Open Scratch and click “Create” to create a new project. Delete the default cat image, then choose a suitable background by clicking the “ buttonChoose a Backdrop” in the lower right corner (green in the image above). This example selects Galaxy.

How to make a flying cat in Scratch

After choosing the background, the next step is to add the image of the flying cat. Click the button “Choose a Sprite” in the lower right corner, search for “cat flying” and click on the cat image that appears.

Code that makes cats fly

The final step is to add the above code to your program. Let’s see what each command block does!

  • When green flag clicked: The code below this block will run when the green flag is clicked.
  • Forever: The code inside this loop will run forever (until the stop sign is clicked to end the program).
  • Point towards (mouse pointer): This block makes the object always face the cursor.
  • If (not touching mouse pointer): If the cat catches up to the pointer, we want it to stop. Otherwise, if it doesn’t touch the cursor, we will run the code below.
  • Move (5) steps: This block of code makes the cat move 5 steps each time it is run. If you want to make the cat fly faster or slower, you can increase or decrease this value.
Read More  How to find all ores in The Forge

Create jumping sprites

Make the cat jump

Another useful and simple Scratch exercise is to make a sprite jump. Here is an example:

Create a new project with a sprite, following the instructions in the flying cat exercise. Add the code in this image to your project and be sure to read below to understand what each block of code does.

Code snippet adds code to make cat jump in Scratch

  • When (space) key pressed: The code below this block will run every time the space key is pressed. If you want to run your program using a different key, you can customize it here.
  • Next costume: The sprite will look more realistic when jumping if its animation changes. We can change to the next sprite animation using this block.
  • Glide (.2) secs to x: (x position) y: (y position + 50): To understand this block of code, we first need to understand x and y coordinates. Moving sprites on the Scratch canvas is controlled by an invisible grid, and you can move objects on the grid by assigning them x values ​​and y values. The x value controls the position from left to right, and the y value controls the position from top to bottom. This block of code requires the sprite not to change position from left to right and to move up 50 units. If you want your character to jump slower or faster, you can adjust the value .2 lup or down.
  • Next costume: Change the sprite’s animation when it returns.
  • Glide (.2) secs to x: (x position) y: (y position – 50): This block is the opposite of the previous glide block; it will cause the sprite to return to its original position.
Read More  How to make snow fall in Scratch

Create color-changing backgrounds

Change background color in Scratch

Continuing with the flying cat project above, now you just need to add two steps:

Add backdrop to Stage

Following the steps in the flying cat project above, choose a background image for your project. Then, click on the wallpaper in the “Stage for programming.

Add code blocks to Scratch

Add the following 3 code blocks:

  • When green flag clicked: When the green flag is clicked, the code below will run.
  • Forever: The code inside this block will run forever.
  • Change (color) effect by (5): Each time this block is run, it changes the background color effect by 5. If you want the color to change more slowly, decrease the value; if you want them to change faster, increase the value.

Sprite makes a sound when clicked

To add a sound to the flying cat sprite above, click on the “sounds” tab and click “choose a sound”. Find a sound that suits your project and click on it. Then, click the “code” tab to return to the programming screen.

Practice Scratch

The code for this project consists of only two blocks:

Scratch code block

  • When this sprite clicked: The code below this block will run every time your sprite is clicked.
  • Play sound (grunt) until done: This block will play the sound you choose.

Change sprite size with arrow keys

Add the following four code blocks to the flying cat project:

Change character size in Scratch

  • When (up arrow) key pressed: The code below this block will run every time the up arrow key is pressed.
  • Change size by (10): When this code runs, it will increase the size of the sprite by 10.
  • When (down arrow) key pressed: The code below this block will run every time the down arrow key is pressed.
  • Change size by (-10): When this code runs, it will reduce the size of the sprite by 10.
Read More  How to make a basketball game on Scratch

GameHov is group of expert in gaming industry that cover all gaming news from e-sport to casual video entertainment.

Post Comment