Purpose of the Project: To move our character in the maze game that we will make in the Mblokck 3 program using the joystick module thanks to the Pinoo control card.
Duration: 2 lessons
Age Group: 9 years old and over
Pinoo Sets: Maker set and full set.
Gains:
- Learns to code Pinoo control card.
- Learns to use the joystick module.
- Improves the skill of setting up algorithms.
- Improves coding skill.
Materials to be used: Mblock 3 program, Pinoo sensor card, joystick module, connection cables.
1. Adding Pinoo extension:
From the Extensions tab, we click on the "Manage Extensions" option.
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.
2. Connecting the Pinoo sensor board to the computer:
In Mblock 3, we click on the "Connect" tab on the upper left.
We click on the "Serial Port" section from the window that opens and select the "COM6" option from the page that opens.
NOTE: Since the port entries of each computer are different, the numbers next to the COM text may change.
We click on the ‘’Cards’’ tab.
We select the "Arduino Nano" card option used by the Pinoo sensor card from the window that opens.
We click on the Extensions tab.
In the window that opens, we select the extension "Pinoo" of the sensor card we use.
We click on the ‘’Connect’’ tab.
We click on "Firmware Update" from the window that opens.
3. Coding part:
We open the Mblock 3 program and delete our panda puppet.
We come to the decors section. From here we will draw a labyrinth for ourselves.
We do the background color with our ‘’Fill with Color’’ tool. We can choose any color from here.
We draw our maze walls with our line tool.
By drawing this way we end the labyrinth.
Now we add our main character to our labyrinth.
We choose our puppet as the robot puppet, and from the i (info) part of the robot, we only restrict the rotation to the right and left so that our puppet does not stand upside down.
We add star to gain points, lightning for loss of points and key puppet to end the game.
We will interpret our values in X and Y coordinates, which we will take from our main puppet Joystick module. That's why we define variables named X and Y to transfer these values.
Our game will start with the code when you click on the green flag. Then we switch to the labyrinth decor. We use the go to point code so that our robot puppet is at the starting point when the game starts. Then we transfer the X and Y values from the joystick to our X and Y variables. If the value we get from X value is greater than 550, our puppet will go to the right, if it is less than 450, it will go to the left. If our Y value is greater than 550, our puppet will go down, if less than 450, it will go up.
We define a variable called points to keep our scores.
In order to add the screen that will appear when it is won, we come to the decors section and select the decor from the library and select the decor we want and use our text tool to add the message "Congratulations You Win".
Likewise, in case of losing, we add the décor we will encounter and write our message.
We use the go to point code for our lightning puppet to start at a certain point when the game starts, and our point variable is equal to 0 at the start of the game. At the start of the game our selected puppet will appear. If our lightning puppet is worth our robot puppet, our score will decrease by 1 and our puppet will be hidden.
We also use the go to point code to start our star puppet at a specific point at the start of the game. We use the view code to make it appear. If our star puppet touches our robot puppet, our score will increase by 2 and our puppet will be hidden.
After we finish the coding of our lightning bolt and star puppets, we make a copy. We do not forget to change the go-to-point codes after placing our puppets that we copied in the maze where we want.
We want our key puppet to appear when the game starts and at a certain point in the game start
Since we want it to be, we use our GO code at the point after placing our puppet in the maze. If our key puppet touches our robot puppet, we make it switch to the winning decor and hide our puppet. If the other is in the code block, if our score is less than 5, we make it switch to the losing decor. So getting the key doesn't always mean winning, our score must be at least 5 to win.
In this way we finish.
4. Working Status of the Project:
With our joystick module, we have completed our game by moving our character in four directions. See you in another project
WITH PINOO SETS, CHILDREN CAN MAKE HUNDREDS OF PROJECTS WITH MATERIALS THEY CAN EASILY FIND IN THEIR HOMES.