element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
microbit
  • Learn
  • Learning Center
  • STEM Academy
  • microbit
  • More
  • Cancel
microbit
micro:bit Blog [PROJECT] BBC Micro:bit – Make an Adventure Video Game!!!
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join microbit to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Catwell
  • Date Created: 29 Sep 2018 11:03 PM Date Created
  • Views 1689 views
  • Likes 5 likes
  • Comments 0 comments
  • learn
  • stem
  • project
  • video game
  • microbit projects
  • microbit
  • diy
  • game
  • bbc microbit
  • cabeatwell
  • stem projects
Related
Recommended

[PROJECT] BBC Micro:bit – Make an Adventure Video Game!!!

Catwell
Catwell
29 Sep 2018

Legend World Adventure Quest, Championship Edition Super Turbo

 

“If you only ever play one video game in your entire life, this is it!” – Game Xtremist Chronicle

“To be in the presence of true game genius is a gift few will experience. Play this game!” – Video Game Journal Magazine

“Wow! Just Wow. Perfection in pixels.” – Game journalist person

 

Game description;

On a hollow planet, 400 times the diameter of Earth, Xzanik faces the greatest challenge of any life. Survive the vast labyrinth of the villains’ mega-huge world. From vast forest mazes, winding mountainous cliff walls, to the depth of fiery catacombs – the hero must trudge. Imperceptible, impossible, incomprehensible obstacles await.

As the planet spins faster and faster, darkness falls across the monstrous planet every few minutes – seeing and remembering is Xzanik’s only power.

Unparalleled adventures, unparalleled graphics, unparalleled parallels at every turn. Venture forth, if you dare!

 

---------------------------------------------

 

The BBC Micro:bit is a surprisingly powerful tool for a lot of tasks. I wanted to use the LED matrix “screen” for something more than just troubleshooting the code. I wanted to make a game!

I wanted to make an adventure game. Something reminiscent to old PC games from the 12” floppy disk days. With the limited screen size and controls, I put together something simple.

The software works as follows:

- The game starts and shows you a map with obstacles. Soon, the map disappears, leaving your player character in the upper left of the screen. The player character is a high-resolution single pixel.

- The goal is to get to the other side of the screen without touching an obstacle. If you do touch a wall, the map will reset.

- Repeat endlessly.

 

 

First, let’s gather all the necessary components you’ll need to build this project.

Let’s make it a mobile gaming platform too! I am recommending a battery pack. I used 2x AA rechargeable batteries out of curiosity; if rechargeable AA cells are usually at 1.2V, will it be enough to power everything at 2.4V or less, without issues? --- The answer is, yes, it’s fine. J

1x BBC Micro:bit

1x 3 V battery pack (For mobile gaming! image )

2x AA batteries

 

Video game demonstration:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

STEP 1

Load the code onto the Micro:bit.

 

I am providing the hex file you need to drag and drop onto the Micro:bit, and the python code as two separate files. For the below process, just use the hex file.

 

Plug the MicroUSB cable into the Micro:bit, and plug the other end of the cable to a PC or MAC.

 

At this point, you are going to copy over the code to the Micro:bit. I am providing the program (code) in this posts that needs to be copied over. When the Micro:bit plugs into a computer, it shows up as a USB flash drive. All you have to do is copy the file over to the Micro:bit, like it’s a USB Flash Drive, and the Micro:bit will reset, and the program is active.

 

You could leave it plugged into your computer, or use that 5V USB power adapter to make the project a bit more mobile.

 

STEP 2

Insert the batteries into the battery holder, and plug said holder into the Micro:bit.

 

The game will immediately start. You’ll see the word “START” scroll across the screen first.

 

- The game will flash the map 3 times. Then the player character will appear at the upper left of the screen.

 

STEP 3

image

- You need to get from the upper left of the screen to the bottom right.

- If you succeed, a “happy face” will appear.

- If you fail and hit an obstacle, it will show a “sad face.”

 

Here are the game controls:

● Button A goes down

● Long press Button A, will go back up

● Button B goes to the right

● Long press Button B, will go left

● Press both A & B at the same time will go at a down angle. Down one, to the right one.

● Long press A & B at the same time, will go up at an angle. Up one, to the right one.

 

STEP 4

The game will go on endlessly.

Enjoy!

 

Code talk

I commented the code, so please take a look at it in the "microbit game 3.py" file. I use Notepad++ for code, in case you were wondering.

With the comment, you should be able to see what each section does.

 

But here are a few sections that I thought were worth mentioning:

 

I store each map as an array. One digit for each "pixel" LED.

image

 

For generating maps, I used the random.randint() function in Python to generate pseudo-random numbers for the maps. I think as the maps go on, there are too many obstacles. So, I suggest tweaking these parameters a bit. Change x+y < 8  to maybe  x+y < 6 or even 5.

image

 

In the main game loop is where I added the constant polling of the buttons. I am taking this out to show you how you could use the buttons for a game or anything else for that matter.

First I check button A, then check button B. Eventually, one of these has to be pressed, so I start analyzing what is going on once a press is detected. The next step is to see if the other button is pressed. Then, I deal with a "simultaneous button press." In this case, the player moves at an angle on the map.

image

 

Conclusion

This is a simple game, yes. It is also a foundation for much more.

 

If I had more time and resources:

- I could add a plan for the map progression. In other words, an ultimate goal.

- I could use an external controller without much work. The Micro:bit has a lot of I/O.

- I thought about adding items that the player must find. But, did you ever play any of the old adventure games from the old PC and Atari days? They are maddening. So, I thought, for now… a memory game is better.

 

http://twitter.com/Cabe_Atwell

Attachments:
microbit game v3.zip
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube