Over the past few years, the promotion of coding has been on the minds of many tech companies, such as Apple and Microsoft. The website Code.org is promoting that anyone can code for at least an hour. Many public education schools are encouraged to take part in basic coding as students can create games, interactive stories, and much more! There is a great variety of programs for beginners, such as Scratch, Minecraft Education Edition and Alice 3.0. As a newbie to coding, I decided to use the Scratch application.
I decided to choose Scratch because it has a simple interface to learn the basic concepts of coding. Scratch is broken down into three columns: nine colour-coded categories of buttons, the coding blocks, and the coding script board. The coding blocks are easy to drag and drop onto the coding script board. Consider the coding blocks to be like simple statements, which will take time to learn. Scratch includes many step by step tutorials that are accessible from their online website. I wanted to create a classic game of Pong.
How I coded pong
Step 1: First, I had to create a backdrop, which is the background of the game. I choose the soccer field with two nets as the backdrop. I wanted to be creative and use a soccer ball instead of the traditional pong ball. Next, I had to pick a Sprite, which is the object that I will use for coding. The soccer ball was a good choice as I can code it to move and bounce around.
Step 2: I clicked on to the blue “motion” button and dragged the “move 10 steps” block to my coding script board. Then, I clicked on to the orange “control” button and dragged the “forever” block on top of the “move 10 steps” block. However, I had to go back to the blue “motion” button and add the “if on edge, bounce” block below my “move 10 steps” block. This will allow the soccer ball to move back and forth.
When I clicked on the grouped set of blocks, the ball bounced side to side without any problems. I went back to the blue “motion” button to add the “point in direction” block, which was placed on top of the “forever” block. I changed the direction value from 90 degrees to 45 degrees. Next, I went to the orange “events” button to drag the “when green flag clicked” block on top of all the coding in the script board. I clicked on the green flag and the program executed. The soccer ball successfully bounced back and forth in all different directions instead of side to side.
Step 3: The paddle was the next item to be coded and it required three different coding blocks. From the orange “events” button, I dragged the “when green flag clicked” block on to the coding script board. Next, I went to the orange “control” button and dragged the “forever” block underneath. Then, I went to the blue “motion” button and dragged the “set x to” block under the “forever” block. However, I had to go into the blue “sensing” button to drag the “mouse x” block into the “set x to” block. When I executed the program, I had the paddle moving side to side and the soccer ball was moving in all different directions. Also, I can click on the Paddle Sprite and move it to the bottom of the game screen. Now, it was time to program a way for the soccer ball to bounce off the paddle.
Step 4: All that was left was to place a red line that would end the game if the soccer ball fell off the screen. I found a Red Line Sprite and I placed it on the bottom of the screen. I added the following code: “when green flag clicked” block, “forever” block, “if – touching soccer ball” block, “stop – all” block. This code will allow the soccer ball to instantly stop when it hits the red line.
Overall, a good coding program for beginners
Scratch is a great coding application for beginners, which is accessible on the web or available to download on your computer. From the website, I have seen people share animated stories, animated sprites (characters), create games, quizzes, films, and MEMES. I found that the online tutorial videos were extremely helpful by showing how to complete each step before moving forward. However, I wish there was a tutorial to explain the user interface and how to use the functions in the program. I use the concept of Lego blocks as you are building code on each stack. Some university students may be able to use this skill set in their future work profession. If you are looking for a new hobby or always wanted to try coding, give Scratch a try!