Star Game With Pinoo (Slope Impact Joystick Arm)
Purpose of the Project: Using the Pinoo control card to create a game console with tilt and impact sensor for a star collecting game.
Duration: 2 lessons
Age Group: 7 years and older
Set Used: Maker set, Ful Set.
Benefits:
• Learns to code Pinoo control card
• Learns to code inclination and impact sensor.
• Improves the skill of setting up algorithms.
• Improves coding skill.
Materials to be Used: Mblock 3 program, Pinoo control card, tilt and impact sensor, connection cable
Materials Required for Design: Forex, scissors, silicone gun, paint, felt
Project Preparation:
We cut a piece into forex by drawing the shape of the spacecraft we want. This piece will be our game console.
We design and paint the details.
We open a tilt-impact sensor-sized window anywhere on our game console. We fix the sensor to the window we open with the help of a silicone gun.
Let's make our connections. We place our Pinoo control board on the back of the game console and connect the tilt and impact sensor to the purple input # 1.
We have completed our connections, now let's move on to the coding part. For this, we will use the Mblock-3 application.
Let's connect our Pinoo control card to the computer with the help of a connection cable and enter the Mblock3 application. Then, let's introduce our Pinoo control card to the computer. To do this, we first click on the serial port option from the Connect tab. Then we select COM3. (The number may differ according to the computer and the 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" in the search engine and just click download to the result. It has been 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 design the game. For this, we delete the panda by clicking the right mouse button on the panda puppet. Then we add the puppet named Star1 and Spaceship by clicking the new puppet button.
In order to change the stage, we select the moon scene by clicking the ‘’select new decor from the library’’ button in the ‘Stage’ section.
We click on the Star1 dummy that we added and when the Green Flag is clicked from the Events menu, we get its code to start the game.
Since all the code blocks we will write have to run continuously until the game is over, we get the code block from the Control tab continuously.
We want the star puppet we added to appear at random points of the scene starting from a certain point. To do this, we first determine the starting position and take the x: 142 y: 80 code block in the Movement tab. Here the numbers corresponding to x and y may vary.
Here we update it to x: 0, y: 140.
In order for the star to move slowly in random positions from top to bottom, we receive the command to float to x: 0 y: -20 in 1 second from the Motion tab. Here the values corresponding to x and y may differ from you.
Instead of the x value, we place the code block that hold a number between 1 and 10 from the Operations tab. In the block, we write -180 instead of 0, and 136 instead of 10.
Finally, we write the value -20 instead of y.
While the stars are moving randomly, we want to earn points if the spacecraft is worth it. We will create a Control block for this. We will get the code block from the Control tab.
In order to understand whether we are touching the Spaceship puppet, that is, the spacecraft, we take the code block from the Detection tab. Click on the small arrow next to the box to choose the name of the spaceship.
We will use variables to calculate a score. From the Data & Block tab, click the ‘’create a variable button’’ and create a variable named score.
If the requirement is met, we get the increase 1 point command from the Data & Block tab to earn 1 point.
We click on the SpaceShip dummy that 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.
In order to reset the score at the beginning, we get the code block from the Data & Block tab to get the score 0.
Since all the code blocks we will write must run continuously until the game is over, we are getting the code block from the Control tab continuously.
If an impact is detected in the tilt and impact sensor, that is, in our game console, we want our spacecraft to jump.
We will use the control tab, if so, the block to check whether the sensor has been hit or not.
To create the Condition section, we get the equals statement from the Operations tab. In the first box, we place the code block related to the inclination and impact sensor from the Robots tab. We change the pin number to pinoo1. In the second box, we write the number 1, which indicates that the sensor has been hit.
If the condition is met, the puppet must move the spacecraft up (y direction relative to the coordinate axis) for 0.5 seconds and then descend on the same axis. For the upward movement, we receive the increase y 10 command from the Movement tab and update the number 10 to 80.
In order to do this for 0.5 seconds, we take the ‘wait 1 second’ command from the Control tab and update the 1 figure as 0.5.
We receive the command to increase y by 10 so that the puppet can move down the y-axis with the same length. We update the number 10 to -80.
If our score is equal to 10, we want the game to be over. To create a condition 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 10 in the second box.
In order to give feedback about the end of the game, we get the 2 seconds command from the View menu. We change the word ‘Hello’ to ‘GAME OVER’.
To finish the game, we get the ‘’stop all code’’ block from the Control tab.
After completing our codes, we check the operation of our game by clicking the green flag.
- The stars must be moving in random directions,
- Our spacecraft (SpaceShip) must jump when we tap the sensor,
- We should be earning 1 point each time the star hits the spacecraft.
- When our score is 10, the game should be over.
WITH PINOO SETS, CHILDREN CAN DO HUNDREDS OF PROJECTS WITH MATERIALS THAT CAN COMFORTABLY AT HOME.