Have you ever wanted to make your own video game, but you are not sure where to start? Scratch is what you need! This is a fantastic free tool for creating your own game and animation using “Block Code,” which is a simple version of text -based coding. After you learn the basis of the block, there are many types of games that you can make. For example, you can follow this tutorial to learn how to make a catch game at the beginning.

To study the LED coding directly by the Expert Instructor, register your child in the award winner coding class. Most students start with Scratch Junior (K-2 class) and Scratch Ninja (classes 2-5), designed by professionals from Google, Stanford, and MIT.



Learn how to make a catch game at the beginning

Below are steps to make game catch games at the beginning. If you get lost, visit the project link to see the game that has been completed.

1. Select your catch

First of all, you need to decide what character you want to get to catch your items! Select your sprite by clicking on the blue circle on the bottom right with a cat image on it (the red button in the red image), then select the sprite from the scratch sprite library.

Choose your catch

2. Move your catch

To capture objects -benda, your sprite needs to move left and right. To do this, you must first drag the yellow “on green flag”, then loop “forever” orange. Now, if you think about it, you want your character to move to the right with a number if you press the right arrow button, and left when pressing the left arrow button. Which block do we use to check “if” a correct condition? Check the image below for the answer!

Code to move your catch

3. Position the item above the screen

You now need to add a second sprite to the game, once again clicking on the blue circle in the lower right corner to select the sprite from the sprite library. When our game starts, we want it to go to a random position at the top of the screen. The two blocks that we will use for that are the “Random” Blue Block and the Blue “Set Y to” Blue. In this case, we will set Y to 180.

Notes: Make sure you choose the sprite that you want to fuss before adding your code! You can check which sprite chosen in the upper right corner of your coding workspace.

Code falls at the beginning

4. Create falling items

In the beginning, Y’s position represents how high or low an item on the screen. If we want the item to go down, what do you think we have to do in Y? If you guess to reduce (or change negatively), you are right! We will also use loops forever to ensure that Sprite continues to fall until it reaches the bottom of the screen. Add the following code to your falling sprite to make it move down the screen.

5. Make a reset item on the screen

At present, our item falls once and then trapped at the bottom of the screen, but we want our item to continue to jump back up to fall again. In other words, ‘if’ the position of the item is below a certain point on the screen, then jump to a random position at the top. The word “if” is a keyword. If you hear it, you should think of using conditional. We will use the condition of “if-later” to realize this. In this case, our condition is if the position of Y is less than -170 then we will reset the position of the sprite, as we did at the beginning of the game! You will find a block less than in the mathematical operator category. Make sure your code matches what you see below.

If you want to know how the code works, try replacing -170 to 0, when will the item be rearranged to the top of the screen? It’s always fun to try a new number in your code to understand what is happening! Don’t forget to test your code often and reset the number you have changed before moving to the next step.

Reset the upper screen

6. Capture items

When the Sprite catcher touched the falling item, the item had to jump on the screen because the player “captured” it. So, “if” the player touches the item that falls, then set the item position fall to the top of the screen. I hope the word “if” makes you think of the word vocabulary, conditional! For this situation, you need to use a block “If you touch the mouse-boings” from the sensing category, but you must click on it to open the dropdown menu to choose your other sprite name (for example, “cat” if you choose a cat sprite).

Instruction: The code highlighted with red is the new code added in this step.

When we run a coding side by side like this, it is called parallelism. Running the code in parallel helps us prevent bugs (disturbances/errors in our code). This concept is not unique to scratching and can be done in other programming languages ​​as well. This is a very useful way to write code. In this case, it will keep the item fall from stop or glazed when caught!

Catch the item at the beginning

7. Score point!

To track the score, you need to make a “variable” score. If you have never used it before, the variable allows you to track numbers when your game runs. Open the category of dark orange variables and click “Create variables.” Give the name “score” variable and select okay after completion. Be sure to check the box next to your new variable so that the score is seen on the screen. This makes it so that players can see the score! We can make it so that every time the sprite touches our falling sprite, the score increases by 1. Don’t forget to set the score to 0 at the beginning of the game. This way you can play games again and again! After you add this block, you will have a complete game!

Complete the game and score points

Review the key programming concept that we are using today

  1. Sprite and costumes:
    • Sprite: This is a character or object in the game. Each sprite can have several costumes.
  2. Program:
    • When the green flag is clicked: This block starts the program when the green flag is clicked. You can use it to initialize the game.
  3. Movement and position:
    • Move Steps: This block moves the sprite a number of certain steps in the direction at hand, to control the movement of the character in the game.
    • Go to x: y: This block places the sprite at a particular coordinate location on the stage.
  4. Control structure:
    • Forever Loop: This loop runs a closed block continuously until the program stops. Use to maintain certain actions, such as checking the collision or controlling the sprite with the keyboard button.
    • If so: This conditional statement runs a block in it only if the conditions are determined correctly. It is very important for decision making, such as checking whether the sprite has reached a certain position.
  5. Variable:
    1. Variable: This is used to store information that can change, such as player scores or level numbers. Variables are very important to track the status of the game and update it as needed.

Create a cool catch game at the beginning

And so: your own initial arrest game. For additional challenges, see whether you can add sound effects to your game and/or add extra items. You might even want to add items that reduce from the score transfer -adding to add what players must avoid. Furthermore, your child might also enjoy building this Extraordinary initial project.

If your child has fun making this catch game, register them in a free scratch introduction course. They will start working with instructors, stay online, who will teach them how to make their own animation and games that are extraordinary at the beginning. Or, if they have the previous initial coding experience, consider trying the free Roblox Coding Intro Course. Whatever the way you choose, they will definitely build their coding skills while fun!

Written by the Instructor for & Learning Dominic Occhietti. Dominic is a graduate of Michigan State University, where he studied music performances and computer science. He really enjoyed teaching, whether it was a coding class, French horns, or even SKI lessons declined!



Game Online

Motivation

News

Pendidikan

Pendidikan

Download Anime

Gaming Hub

A gaming hub can refer to a central platform or space dedicated to gaming, where players can access games, interact with other gamers, and enjoy related content.

Kiriman serupa