Bouncy Game with Pinoo
Purpose of the Project: Using the Pinoo control card, to create a game console for the jumping game with the distance sensor.
Duration: 2 lessons
Age Group: 7 years old and above
Pinoo Set: Basic set, invention set, maker set and complete set.
∙ Learns to code Pinoo control board
∙ Learns to code the distance sensor.
∙ Algorithm building skill develops.
∙ Coding skill develops.
Materials to be used: ∙ Mblock 3 program, Pinoo control card, distance sensor, connection cable.
Materials Required for Design: Forex, scissors, silicone gun, paint, double-sided tape.
We cut a piece by drawing the snowflake shape we want into Forex. This piece will be our game console.
We fix the distance sensor anywhere on our game console with the help of a silicon gun.
We decorate it as we wish.
Let's make the connections. We place our Pinoo control board on the back of the game console and connect the distance sensor to the purple input number 5.
We have completed our links, now let's move on to the coding part. We will use Mblock-3 application for this.
Let's connect our Pinoo control card to the computer with the help of a connection cable and enter the Mblock3 application. Later, let's introduce our Pinoo control card to the computer. For this, we first click on the serial port option from the Connect tab. Then we choose COM6. (The number may differ depending on the computer and port.)
After making the serial port connection, let's select the card we will use from the cards tab. We are working with Arduino Nano model.
In order to add the Pinoo extension to our computer, we click on the manage extensions option from the extensions tab. In the window that opens, we type "Pinoo" into the search engine and simply say download to the result. It was installed on our computer.
We come to the extensions tab again and click on the Pinoo option. We will write our codes with the Pinoo extension.
In the coding part, we will first do the game design. For this, we delete the panda by clicking the right mouse button on the panda puppet. Then we add the puppets named Penguin1, three Satr1 and Tree-Lights by clicking the new puppet button.
In order to change the stage, we select the slopes scene by clicking the Select new decor from the library button in the stage section.
To start the game, we get the code when the Green Flag is clicked from the Events menu.
We want the penguin puppet we added to appear at a certain point in the beginning. For this, we first determine the starting position and get the x: 12 y: -123 code block in the motion tab. The numbers corresponding to x and y here may differ for you.
Here we update it to x: 12, y: -123.
After placing the puppet at the starting point, all the actions it will perform will be repeated continuously until the game is over. For this, we get the repeat code block from the control tab.
In the game, the penguin character will jump and try to collect the snowflakes. Here, we will make the puppet jump using the distance sensor when we jump to our game console. If the distance sensor value is less than five, we want the dummy jump. For the if statement, we take the code block if it is from the control tab.
To create the condition section, we get the less than statement from the operations tab. In the first box, we place the code block for the distance sensor from the robots tab. We change the pin number to pinoo5. We write the number 5 in the second box.
We will make use of the coordinate system so that the puppet can move vertically (to appear as jumping). Since the vertical movement refers to the y axis on the plane, we get the increase y by 10 command from the movement tab. We update it to 50 in the 10 expression. Since it needs to do this process for 0.5 seconds, we get the wait 1 second command from the control tab. We update the number 1 to 0.5.
In order for the puppet, whose height we have increased, to come to the ground again (to the point where it came from), we take the increase y by 10 command from the movement tab and update the number 10 as -50.
We click on the Star1 puppet we added and get its code when the Green Flag is clicked from the Events menu to start what needs to be done at the beginning of the game.
We want the snowflake to be able to appear randomly at different points of the scene continuously. For this, we first start by taking the repeat code block from the control tab.
When the snowflake comes to a point on the stage, we will use the word "hog" when it comes to the edge so that it does not get stuck there. When we get to the edge from the motion tab, we get the eight code block.
In order for the puppet to appear at random points of the scene with 1 second intervals, we take the go to the mouse arrow code block from the motion tab and select the random stage point expression by clicking the tiny arrow next to the mouse arrow text. To do this for 1 second, we get the wait 1 second code block from the control tab.
In order to start the other features that need to be done at the beginning of the game, we get the code when the Green Flag is clicked from the Events menu.
While our penguin is jumping, if it is worth the snowflake, we want to hide the snowflake first and then earn points. We will use variables to calculate a score. From the Data & Block tab, we click the Create a variable button and create a variable named point.
In order to reset the score at the beginning, we get the code block from the Data & Block tab to get 0 points.
In order to make the puppet visible at the beginning, we get the view command from the view tab.
After the initial commands are completed, we get the code block from the control tab to repeat the operations we will do continuously.
While the snowflake moves randomly, we want to earn points if the penguin is worth it. We will create a control block for this. If it is, we get the code block from the control tab.
In order to understand whether we are touching the Penguin1 puppet, that is, the penguin, we take the hit code block from the detection tab. We select the Penguin1 name by clicking the tiny arrow next to the box.
If the condition is met, we first get the command to hide from the view tab in order to hide the puppet and earn 1 point. Then we get the increase the score by 1 command from the Data & Block tab.
If our score is equal to 3, we want the game to be over. To create a conditional statement, we first take the block of code, if any, from the control tab.
To create the condition section, we get the equals statement from the transactions tab. We place the score block from the Data & Block tab. We write the number 3 in the second box.
In order to give feedback at the end of the game, we get the code block from the Data & Block tab with a score of 0. We change the expression 0 to GAME OVER. To end the game, we get the stop all code block from the control tab.
*** We complete our game by writing the same codes on the other two snowflake puppets.
After completing our codes, we fix the console on the monitor with double-sided tape. We check the operation of our game by clicking the green flag.
∙ Snowflakes must be moving in random directions,
∙ The penguin must be jumping when the sensor sees our hand,
∙ We must be earning 1 point each time the snowflake touches the penguin. ∙ When our score is 3, the game should be over.