Follow Our Future Articles
Get new content delivered directly to your inbox.
Use PyInstaller to Create Executable of Python PgZero Game – Windows Version
If you develop a game with Pgzero or PyGame, you might want to invite your friends to play it. However, some of your friends do not use Python, so they do not have the Python development environment, or you do not want to share your Pgzero code at that moment. How do you wrap your…
Code Structure Change When Converting Blockly Language into Pyton Code for LEGO MindStorms
When we start to write Python code for LEGO MindStorms models, we tend to convert existing Scratch blockly code into Python version and check if it works. Although LEGO has made effort to create Python methods which could match the functionality of Scratch programming blocks, the Python code structure is much different from that of…
Use LEGO MindStorms Inventor to Create a Rolling Pattern – With Python
As we know, LEGO MindStorms Inventor provides animation functionality. In the Animation Editor, we could specify the light matrix pattern, then call the “play animation” block to play it. However, how about we want a pattern rolling freely on the light matrix? just like what the below video shows. We could not use the built-in…
How to Store and Run Multiple Programs on LEGO MindStorms Inventor or Spike
If you have a LEGO MindStorms Inventor or Spike Prime set, you might wonder how to store multiple programs to the smart hub and then switch to the program you want to run. In this post, I will demonstrate how to download and store multiple programs. Now I have a project called “pet dog”, as…
Use LEGO MindStorms Inventor to Build a Pet Dog – Code it with Both Blockly Language and Python – Part Two
In the previous post, I introduced how to use blockly language to control LEGO MindStorms Inventor, and write code for the pet dog. As I have already mentioned, we could accomplish the similar functionalities by using Python. In today’s post, we will use the Python editor of LEGO MindStorms Inventor App to implement the same…
For Those Who Could Not Run MakeCode for Maqueen Plus 2.0, here is the Solution
If you bought the Maqueen Plus 2.0 recently, you might meet the same issue which I encountered. I spent several hours trying to make it work, but it seemed the motors were not working properly at all. The program could not control either the movement direction and speed of the motors. The most possible reason…
Use LEGO MindStorms Inventor to Build a Pet Dog – Code it with Both Blockly Language and Python – Part One
If you once played the LEGO MindStorms EV3, you might have built one of its sample projects Puppy, which I explained in my previous posts. Several years ago, when EV3 has not yet supported the Scratch blockly language, the puppy code is pretty complicated and confusing. In this post, I will use LEGO MindStorms Inventor…
Create a Dodge Game on Micro:bit by Using Python
In my previous post, I introduced how to create a dodge game on the smart hub of LEGO MindStorms by using MicroPython. In this post, I would like to introduce how to write a Python version of dodge game on micro:bit by using its new Python Editor (beta version). The final effect could be like…
Coding Micro:bit with Python – Which Python Editor to Choose From?
If you feel that LEGO robot is too expensive, you have another choice micro:bit. There are several editors we could use to code micro:bit. What are their differences and which one is better if we want to code micro:bit with Python? In this post, I would like to compare briefly several editors for micro:bit. The…
Use LEGO MindStorms Smart Hub to Design a Dodge Game – This Time Using Python
This post is closely related to my previous post – use LEGO MindStorms Smart Hub to design a dodge game. The difference is that in this project, I will use Python to implement the same functionality as I did in the previous post. If you are interested, you could open the two posts side by…
Use LEGO MindStorms Smart Hub to Design a Dodge Game – Refer to a Micro:bit Sample Project
Recently, we have been exploring Micro:bit and its huge eco-system to see if we could bring some high-quality lessons to our existing workshop portfolio. Honestly, I am amazed by the Micro:bit eco-system. It is compatible to large amount of hardware, especially the sensors. Soon, I will update a post about the comparison between Micro:bit and…
First Experience of CoderZ and Comparison between Cyber Robotics and Physical Robotics
The first sight of CoderZ gave me the impression that it was teaching some simple operations of turning and moving, as well as math calculation, especially when I do the activities in its trial lesson CoderZ Adventure with LEGO Education Spike Prime. If that is the case, the difference between cyber robotics and physial one…
Make Your LEGO Robot Play Tic-tac-toe Game
When we have a LEGO MindStorms set, we could create different models to simulate real world mechanics or creature. We could make the robot carry a stuff, follow a route to transfer the stuff. There is no limitation for the creation. In this post, I would like to introduce a project of having the robot…
A Self-help Guide to Learn Pgzero and Develop Python Games
If you have read my previous post PyGame is too complicated? Try PgZero, you might have an impression that Pgzero is much simpler to be used than PyGame. On the other hand, you might think it could only develop some simple games. Actually, using proper tools, we could use Pgzero to develop any games which…
Find Maximum Prime Factor of a Number by Using Python – Algorithm Explanation
Recently, I am teaching students algorithm using Python. One question is to find maximum prime factor of a given number. When we consider algorithm, we should consider both the running time and occupied memory of the program when the input is an extremely big number. The following algorithm is very typical to get the prime…
A Method to Encrypt the Answer in Scratch Programming
If you are designing a quiz project in Scratch, you will check if the user could answer the questions correctly. However, since all the published projects share the code, your user could always “see inside” of the project and get the answer, like the following code snippet. How could you test your user without getting…
PyGame is too complicated? Try PgZero
In my previous posts, I introduced how to use PyGame to design 2D games with Python language. Pygame adds functionality on top of the excellent SDL library. User controls the main loop, designs their program functions and different sprites’ interaction. This gives user greater control in creating fully featured games and multimedia programs in the Python…
Remotely Control Your LEGO MindStorms Inventor
Assuming you have created a LEGO vehicle with the robot LEGO MindStorms Inventor, now you would like to use its remote control function to control it manually. What should we do? In this post, I would like to introduce a simple vehicle model and the code to realize remote control. Finally, I will explain how…
Which Apps Should I Use for LEGO Robots?
Recently, LEGO has updated its robotics software, especially for the products of LEGO MindStorms EV3 and LEGO MindStorms Inventor. Facing so many apps, you might wonder which apps you should install and what are their differences? In this post, I will introduce the apps of three LEGO robots, their download positions and differences. LEGO MindStorms…
Play LEGO Robotics – Common Steps of Designing Your Own Model
No matter which LEGO robotics model you are playing with – LEGO WeDo 2.0, LEGO EV3, LEGO Spike Prime or LEGO MindStorms Inventor, one of the most exciting tasks could be to create your own model and make the model move with the control of LEGO App or other software. However, it is often easier…
LEGO Spike Prime – Design an automatic door
In today’s post, I would like to introduce a model made of LEGO Spike Prime. If you are using LEGO MindStorms, you could design this model, too. Since this two sets share many similar blocks. This is an open-ended project for the students. As instructor, we just put forward the requirement and then left it…
From PyGame to GoDot – What’s Their Difference?
About PyGame If you would like to use Python to develop 2D game, your first choice might be PyGame, which is popular among Python game developers. Go to the website https://www.pygame.org/docs/ref/key.html, you could browse all of the classes and their explanation. All of the stuffs are grouped into the pygame library. If you do not…
Use PyGame to Create Tetris Game – An Updated Version Part 2
In my previous post, I introduced the first part of Tetris game written in Python. Today, let’s continue the left part of the code. In the first part, we have introduced the class Piece and several functions which will be used by the main() function. Now, let’s see what the main() function is doing. Starting…
Use PyGame to Create Tetris Game – an Updated Version
In the previous posts, I once analyzed a Tetris game developed in Scratch. It uses Pen drawing tab to draw all the tetris pieces. However, due to the limitation of data structure in Scratch, the code structure is super complicated compared to other Scratch projects. How about we implement it in Python? On YouTube, some…
Use Python PyGame to Design a Game – Part 2
In my previous post, I introduced how to use PyGame to design a simple game and use project Catch Butterfly as an example. However, how to design a game with many butterflies at the same time? Based on the previous Catch Butterfly project, we might need to create several lists to store each butterfly’s position,…
Learn Scratch by Analyzing Others’ Project – Platformer Game with Editing Functionality Part 4
In the previous posts, I introduced the core sprite of the Blocky game, the “Blocks” sprite, which is responsible for adding, deleting or editing the environment blocks. Starting from this post, we are going to switch to the other core sprite – Hitbox. Homescreen UI Sprite Before introducing the code of Hitbox sprite, I would…
Python Programming: Use Turtle Library to Realize Animation
In the previous post, I use Scratch 3.0 to create animation with Pen functionality. Could we do the same thing using Python? Definitely Yes. We could use Turtle library to generate the same effect, but with more concise code structure. In this post, Let me introduce how to implement it. If you would like to…
Scratch Programming – Animate with Pen
In previous posts, I analyzed many games made of Scratch 3.0 platform. Among them, some use Pen functionality to draw life value bar (Airplane Game), draw the grid in puzzle game (Purple Game), draw blocks in Tetris game, or draw water streams to generate animation. You may have known that because of the fast speed…
Learn Scratch by Analyzing Others’ Project – Platformer Game with Editing Functionality Part 3
In the previous post, I introduced part of the Stamp block. As I have said, this is a very long code segment and its functionality could be divided into three parts. In the previous Part 2 analysis, I analysed the first functionality – drawing the blocks on the stage. In this post, I will continue…
Learn Scratch by Analyzing Others’ Project – Platformer Game with Editing Functionality Part 2
In Part 1 of this project, I introduced how this game realized some stylish visual effects, how to encode its data and store the data in a file, and how to import the data from a file by decoding its data and filling in several lists. In this post, I would like to explain how…
Follow Our Future Articles
Get new content delivered directly to your inbox.