The Best DIY STEM Tutorials and Projects
OVERVIEW
We’re going to use all the cool stuff we’ve learned so far to create a simple but awesome game! In this game, our main character, the panda, will chase the mouse whenever the mouse cursor is on the stage area. It’s going to be so much fun watching our panda friend follow the cursor around!
Objective
Let’s create a game where, once you click the green flag, our adorable panda will follow the mouse pointer around the screen. It’s going to be a super fun adventure.
Instructions
Step 1: Look for the blocks shown in the image below. You can find these blocks in their respective categories, just like we learned before – match the colors to help you locate them easily.
Step 2: Here is a little zoomed-in pic of these 4 blocks, can you guess how to arrange them?
Step 3: Now arrange them as shown in the pic below, blocks should snap together perfectly
Step 4: Great Work, Now click the green flag icon, and move your mouse pointer around the panda, notice anything? Is the panda moving toward the pointer or just rotating (in direction of the pointer)? tell us your answer in the comments below
Step 5: You can press this green flag to start your code, red to stop, and press the icon on the left to go full-screen stage if you want, as shown in the image above, now stop the game by clicking on the red icon
Step 6: Wait but our game is not yet complete we still have to move the panda towards the mouse, now add the 4th block as shown in the pic below
Step 7: Now arrange the 4th block as well as shown in the pic, now click the green flag again to run the code, hurray, now everything is done, and the panda is following the mouse
Now Let’s Try to understand why we arrange these blocks the way we did:
- When Green Flag is Clicked
- Forever
- Point towards mouse-pointer
- move 10 steps
This means we are instructing our sprite (panda) that: whenever the green flag is clicked, the panda will keep pointing towards the mouse pointer and move 10 steps.
Awesome work, buddy! If you have any questions or need help, just leave a comment or contact us. We’re always here to help you out!
Tell us in the comments how you feel about making your first game, we will soon combine electronics and this mblock coding to make very cool stuff 🌟💡
Dont forget to share a video of your project with us , thanks !