# Re-MakeCode the Classics: Py Hunter

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/076/729/medium800thumb/gaming_GuideSplashPlayPyHunter.jpg?1560196273)

https://youtu.be/v23MDNK76Uc

In this guide, we'll Re-MakeCode the thrilling car-chase arcade game classic, **_Spy Hunter!_** But since its on a PyBadge or PyGamer we'll rename it (and tweak the design a bit) to create **Py Hunter**

We'll learn how to create an endless road level, high speed enemies, car bumping mechanics, smoke screens, freeze rays, a custom health meter, and more!

[Microsoft MakeCode Arcade](https://arcade.makecode.com/beta) is a **web-based** beginner-friendly code editor to create **retro arcade games** for the web and for microcontrollers.

![](https://cdn-learn.adafruit.com/assets/assets/000/076/578/medium800/gaming_components_hero.png?1560097935)

Info: 

## Parts

You can play your game in the browser, with no added parts, or get one of these great handhelds to play with real hardware on the go!

### Adafruit PyGamer Starter Kit

[Adafruit PyGamer Starter Kit](https://www.adafruit.com/product/4277)
**Please note: you may get a royal blue _or_ purple case with your starter kit (they're both lovely colors)**

What&nbsp;fits in your pocket, is fully Open Source, and can run CircuitPython, MakeCode Arcade or Arduino games you write yourself? That's right,...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4277)
[Related Guides to the Product](https://learn.adafruit.com/products/4277/guides)
![Adafruit PyGamer Starter Kit with PCB, enclosure, buttons, and storage bag](https://cdn-shop.adafruit.com/640x480/4277-08.jpg)

### Adafruit PyGamer for MakeCode Arcade, CircuitPython or Arduino

[Adafruit PyGamer for MakeCode Arcade, CircuitPython or Arduino](https://www.adafruit.com/product/4242)
What&nbsp;fits in your pocket, is fully Open Source, and can run CircuitPython, MakeCode Arcade or Arduino games you write yourself? That's right, it's the **Adafruit PyGamer!** We wanted to make an entry-level gaming handheld for DIY gaming, and maybe a little...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4242)
[Related Guides to the Product](https://learn.adafruit.com/products/4242/guides)
![Angled shot of Adafruit PyGamer for MakeCode Arcade, CircuitPython or Arduino.](https://cdn-shop.adafruit.com/640x480/4242-00.jpg)

### Adafruit PyGamer Acrylic Enclosure Kit

[Adafruit PyGamer Acrylic Enclosure Kit](https://www.adafruit.com/product/4238)
You've got your PyGamer, and you're ready to start jammin' on your favorite arcade games. You gaze adoringly at the charming silkscreen designed by Ada-friend PaintYourDragon.&nbsp;The nostalgia is palpable!

Cradling the PCB in your hands, you realize there's something...

In Stock
[Buy Now](https://www.adafruit.com/product/4238)
[Related Guides to the Product](https://learn.adafruit.com/products/4238/guides)
![Enclosure pieces and black, plastic hardware for a DIY handheld game console.](https://cdn-shop.adafruit.com/640x480/4238-00.jpg)

### Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino

[Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino](https://www.adafruit.com/product/4200)
What's the size of a credit card and can run CircuitPython, MakeCode Arcade or Arduino? That's right, its the **Adafruit PyBadge!** We wanted to see how much we could cram into a ​3 3⁄8 × ​2 1⁄8 inch rounded rectangle, to make an all-in-one dev board with...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4200)
[Related Guides to the Product](https://learn.adafruit.com/products/4200/guides)
![Angled shot of a Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino. ](https://cdn-shop.adafruit.com/640x480/4200-01.jpg)

### Adafruit PyBadge LC - MakeCode Arcade, CircuitPython, or Arduino

[Adafruit PyBadge LC - MakeCode Arcade, CircuitPython, or Arduino](https://www.adafruit.com/product/3939)
What's the size of a credit card and can run CircuitPython, MakeCode Arcade or Arduino even when you're on a budget? That's right, it's the&nbsp; **Adafruit PyBadge LC!** &nbsp;We wanted to see how much we could cram into a ​3 3⁄8 × ​2 1⁄8 inch...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3939)
[Related Guides to the Product](https://learn.adafruit.com/products/3939/guides)
![Angled Shot of Adafruit PyBadge - Low Cost. ](https://cdn-shop.adafruit.com/640x480/3939-05.jpg)

### Lithium Ion Polymer Battery with Short Cable - 3.7V 350mAh

[Lithium Ion Polymer Battery with Short Cable - 3.7V 350mAh](https://www.adafruit.com/product/4237)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 350mAh for a total of about 1.3 Wh. If you need a larger (or smaller!) battery, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4237)
[Related Guides to the Product](https://learn.adafruit.com/products/4237/guides)
![Lithium Ion Polymer Battery 3.7v 350mAh with JST 2-PH connector and short cable](https://cdn-shop.adafruit.com/640x480/4237-04.jpg)

### Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt

[Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt](https://www.adafruit.com/product/4227)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4227)
[Related Guides to the Product](https://learn.adafruit.com/products/4227/guides)
![Mini Oval Speaker with Short Wires ](https://cdn-shop.adafruit.com/640x480/4227-06.jpg)

# Re-MakeCode the Classics: Py Hunter

## Re-Make Py Hunter: Setup and Mechanics

## MakeCode Arcade

If you're not already familiar with the basics of MakeCode Arcade, [check out this guide](https://learn.adafruit.com/makecode-arcade-pixel-art-sprites/creating-sprites-in-makecode-arcade) on creating a character sprite and moving it with controls.

To start, open a new Chrome browser window (Chrome works best) and go to [MakeCode Arcade beta](https://arcade.makecode.com/beta).

These MakeCode Arcade guides are designed to take you through the fundamentals before tackling more complex games.

- [Pixel Art](https://learn.adafruit.com/makecode-arcade-pixel-art-sprites)
- [Animation](https://learn.adafruit.com/makecode-arcade-pixel-animation)
- [Level Design](https://learn.adafruit.com/makecode-arcade-platform-level)
- _[Sparky Invaders](https://learn.adafruit.com/makecode-arcade-sparky-invaders)_
- [Next Level Game Techniques](https://learn.adafruit.com/next-level-makecode-arcade-games)

For another Re-Make that'll get you caught up on some intermediate-level techniques, check out [Re-MakeCode the Classics: _Arkanoid_](https://learn.adafruit.com/re-makecode-the-classics-arkanoid/overview)

Primary: 

![](https://cdn-learn.adafruit.com/assets/assets/000/076/707/medium800/gaming_arcade-Re-Make-Py-Hunter.png?1560192987)

## _Py Hunter_

We'll start by loading the finished version of MakeCode Arcade _Py Hunter_ and try it out. Then, we'll have a look at some of the unique features and how they work.

Start by launching [MakeCode Arcade beta](https://arcade.makecode.com/beta) using the Google Chrome web browser. Then, download the **Re-MakeCode-PyHunter.png** file above by right-clicking on the image above and saving it to your computer.

## Load the Code

This is a special .png file that contains not only an image, but the entire game is embedded in it as well!

Simply drag it from the location to which you saved the image on your computer (such as the desktop as shown here) onto the Chrome browser window that is already running MakeCode Arcade (MCA). Note that the image in this graphic is of a different game, but you'll be dragging the _Py Hunter_ png file.

This will open the code into the MCA editor.

![gaming_MakeCode_Arcade_3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/580/medium640/gaming_MakeCode_Arcade_3.jpg?1560098527)

![gaming_MakeCode_Arcade.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/581/medium640/gaming_MakeCode_Arcade.jpg?1560098557)

Info: 

Have a go at the game now so you will have a feel for how it plays before we look at the individual elements.

When it starts you'll see the splash screen title graphic and the theme song will play.

Then read the instructions and play! You'll use the d-pad to move the car and the A and B buttons to fire the freeze ray and smoke screen emitters.

Avoid bumping into innocent bystander cars (they're red) while shooting and bumping the bad guys. Don't hit the trees or oil slicks!

## On Start

Here's the first block set which will run when the game loads, the **on start** loop.

![](https://cdn-learn.adafruit.com/assets/assets/000/076/604/medium800/gaming_MakeCode_Arcade_2.jpg?1560111920)

![](https://cdn-learn.adafruit.com/assets/assets/000/076/728/medium800/gaming_MakeCode_Arcade_3.jpg?1560196021)

### Game Start & Splash Screen

The first thing that happens is we set a variable called **GameStart** to **false** -- this will be used later to determine when we can allow the other cars to start moving, and takes the safety off of the player car's fire buttons!

Then, we set the background image to the game's title splash screen, wait one second, and then start playing the background music (BGM) using the **call BGM\_song** function.

## BGM

As we've done in previous MakeCode Arcade games, we'll use functions to organize different repeating sections of the music.

![gaming_MakeCode_Arcade_4.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/607/medium640/gaming_MakeCode_Arcade_4.jpg?1560112161)

![gaming_MakeCode_Arcade_5.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/608/medium640/gaming_MakeCode_Arcade_5.jpg?1560112276)

### Tile Map

Then, we'll create a tile map and tiles to define the game screen. Note, these will be plain colors so we don't notice they aren't moving! We'll use moving trees to give the scene a sense of motion.

![gaming_MakeCode_Arcade_6.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/616/medium640/gaming_MakeCode_Arcade_6.jpg?1560113128)

![gaming_MakeCode_Arcade_7.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/617/medium640/gaming_MakeCode_Arcade_7.jpg?1560113138)

## Create Player Car Sprite

Create the player's car sprite with these settings for control, position, z-depth, and the stay in screen parameter as shown.

The sprite graphic is a cool, white "Interceptor" sports car, just like the original!

![gaming_MakeCode_Arcade_9.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/612/medium640/gaming_MakeCode_Arcade_9.jpg?1560112844)

![gaming_MakeCode_Arcade_10.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/614/medium640/gaming_MakeCode_Arcade_10.jpg?1560113018)

## Health Bar

The next function sets the custom health bar. Rather than use the default heart counter of MakeCode Arcade, we'll make a meter graphic as a sprite with ten divisions on it. We'll also set the z depth to 3 so that it remains above any other objects that occupy the same space, such as trees.

We'll place the position to the upper left corner. Later we'll create a function to change the health bar graphic depending on the player's health status.

![gaming_MakeCode_Arcade_8.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/615/medium640/gaming_MakeCode_Arcade_8.jpg?1560113076)

## Instructions

We'll put all of the starting instructions into **show long text** blocks. Each one requires the player to press ' **A**' to advance, and we can choose where on the screen to display each line.

![gaming_MakeCode_Arcade_11.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/619/medium640/gaming_MakeCode_Arcade_11.jpg?1560113256)

The last thing we'll do in the setup is create and set some variables we'll use later, and use the **splash** block to have the player press ' **A**' to start the game.

These are the variables:

- **sceneSpeed = 200** is used to set **Y velocity** of trees & oil slicks, as well as derive car speeds
- **enemyAShot = 0** used to change behavior of enemy cars when shot
- **freezeExists = false** state of the freeze ray projectile
- **smokeExists = false** state of the smoke screen projectile
- **CarHealth = 100** player car health

![](https://cdn-learn.adafruit.com/assets/assets/000/076/627/medium800/gaming_splash.jpg?1560116635)

## Game Start

We want to give the player a moment to orient themselves before the onslaught of cars begins! So, until they drive the car to the left or forward, the **GameStart** variable is still set to **false** and the other cars won't appear.

Once the player presses either **up** or **left,** the **GameStart** variable is flipped to **true.**

![gaming_MakeCode_Arcade_12.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/626/medium640/gaming_MakeCode_Arcade_12.jpg?1560116008)

## Trees
![](https://cdn-learn.adafruit.com/assets/assets/000/076/646/medium800thumb/gaming_trees.jpg?1560118442)

![](https://cdn-learn.adafruit.com/assets/assets/000/076/644/medium800/gaming_MakeCode_Arcade_14.jpg?1560117508)

The moving trees and bushes will give the scene its sense of speed. Here's how we'll create them.

We'll make one tree and then duplicate the process four times with different parameters.

First, we'll start with a **on game update every** block and randomize it a bit so the trees don't appear to be moving in a set interval.

Then, we'll create a tree sprite as a projectile with all of it's motion on the vertical axis with the **vy (velocity Y)** set to the **sceneSpeed** variable.

![gaming_MakeCode_Arcade_13.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/645/medium640/gaming_MakeCode_Arcade_13.jpg?1560117585)

We'll create a new sprite type named **Tree,** so we can later test for collisions with the cars and this type of sprite uniquely.

We'll have the start position on the **x-axis** be a **random** placement between either **0-40** for the left side of the road or **130-150** for the right side.

Then, place the trees at a **z-depth** of **0** so that other sprites appear on top of them.

## Cars
![](https://cdn-learn.adafruit.com/assets/assets/000/076/649/medium800thumb/gaming_cars.jpg?1560124054)

Here's how the enemy and innocent bystander cars work.

First, we'll use a randomized time interval for **on game update** so they don't spawn at predictable times.

Next, we'll check the **GameStart** variable we set at the beginning to see if the player has moved their car left or up, signalling the beginning of game play.

Then we'll generate the car as a projectile sprite with a velocity that is a fraction of the **sceneSpeed** variable. This means that if you adjust the **sceneSpeed** the car speed will also adjust.

![gaming_MakeCode_Arcade_16.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/647/medium640/gaming_MakeCode_Arcade_16.jpg?1560122800)

![gaming_MakeCode_Arcade_15.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/648/medium640/gaming_MakeCode_Arcade_15.jpg?1560122823)

The horizontal **x position** of the **enemyA** type of car is a random value somewhere in the area of the road, while **enemyB** starts out at the same **x position** as the player's car at the time it is spawned.

The enemy cars are set to type **Enemy,** while the **bystander** cars are of type **Bystander.** Again, just like with the trees, we can test collisions more easily later if we have unique types for the different sprites.

The **z-depth** of the cars are set to 3 so they appear above things such as oil slicks.

The **enemyAShot** variable is created and set to **0** -- this will be used later to determine the moment of these cars when they're shot.

## Enemy A is a Wacky Driver!

You'll notice that the **enemyA** cars try to drive into the player's car no matter where you steer. Here's how this is done:

![](https://cdn-learn.adafruit.com/assets/assets/000/076/650/medium800/gaming_MakeCode_Arcade_17.jpg?1560124250)

Every 100ms the **on game update** block checks to see if there's an enemy A car in the scene with the **enA\_exists** variable, and it also checks to see if the car has been shot. If not, then it sets the **car\_enA\_Diff** variable to the **PlayerCar**  **x position** minus the **enemyA x** position.

If the difference is less than 0 -- meaning the player is to the left of the player car -- then the enemy's velocity on x is set to -10 to steer it toward the player car, and to 10 if it's on the other side.

## Oil Slicks

Just to add one more hazard to the scene, we'll also spawn oil slicks! These are handled in nearly the same way as the trees -- they're **projectiles** that move at the **sceneSpeed** (so they appear to be stuck to the road). They're of type **Oil** so that we can test overlap collisions against them as a unique type later.

![](https://cdn-learn.adafruit.com/assets/assets/000/076/653/medium800/gaming_MakeCode_Arcade_18.jpg?1560126106)

## Freeze Rays and Smoke Screens
![](https://cdn-learn.adafruit.com/assets/assets/000/076/654/medium800thumb/gaming_shooting.jpg?1560126534)

The player can shoot Freeze Rays and Smoke Screens in order to defeat enemy cars.

When the **A**  **button** is pressed, we check to see if the **GameStart** variable is true (otherwise the player could shoot the splash screen!).

Next, we test to see if a freeze ray already exists to prevent the player from spamming the fire button. The **freezeExists** variable stores this state.

If we're in the clear, then we flip that variable, and shoot a **freezray** projectile "forward" with -120 velocity on the y-axis.

We'll also play a tone for a satisfying beep with each shot.

![gaming_MakeCode_Arcade_19.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/655/medium640/gaming_MakeCode_Arcade_19.jpg?1560126718)

![gaming_MakeCode_Arcade_20.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/656/medium640/gaming_MakeCode_Arcade_20.jpg?1560127017)

The smoke screen works the same way but with the **B button** and it travels slowly in the positive y direction, behind the car.

In order to know when we can allow another shot to be fired, the **on destroyed sprite of kind Projectile** block does a couple of checks against the name of the sprite. If it is **freezeray** or **smoke** then their respective **Exists** variable gets flipped back to **false,** allowing them to be fired again.

# Re-MakeCode the Classics: Py Hunter

## Re-MakeCode Py Hunter: Collisions and Game Play

Most of the events in the game come down to one thing -- collisions. When a freeze ray hits and enemy, the play bumps into a bystander car, or runs into a tree, all of these things are collisions.

MakeCode Arcade determines when collisions occur by using the **sprite overlap** blocks. We can set them to activate when all the different types of collisions happen, and then run other blocks depending on the pairings. For example, here's a simple one: when a player car sprite overlaps an innocent bystander car sprite, we'll create a bump effect by moving the player over six pixels in one direction and the bystander 10 pixels in the other direction.

![](https://cdn-learn.adafruit.com/assets/assets/000/076/663/medium800thumb/gaming_bump.jpg?1560134429)

## Don't Bump Innocent Cars!

Here the **sprite of kind Player overlaps otherSprite of kind Bystander.**

We'll play a short tone to indicate the contact.

Then, we check to see if the player car's **x position** is less than the bystander car's **x position.** If so, this means the player is to the left of the bystander car, so we'll move the bystander ( **otherSprite** ) **10** pixels on **x** and the player (sprite) **-6** pixels on **x.**

If the player's **x position** is greater than that of the bystander car's, then the player is to the right of the bystander and we send them in the other directions.

Finally, we penalize the player by lowering their score by **-100** points.

![gaming_MakeCode_Arcade_21.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/657/medium640/gaming_MakeCode_Arcade_21.jpg?1560131439)

## Enemies Bump Bystanders

Here you can see a similar collision setup for when **Bystander** sprites overlap **Enemy** sprites. In this case, only the bystander car is moved to the side. This makes the bad guys seem even badder.

![gaming_MakeCode_Arcade_22.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/658/medium640/gaming_MakeCode_Arcade_22.jpg?1560131768)

## Player Slams into Enemy

When the player bumps into an enemy we use a similar setup as before. However we also do the following:

- add 50 points to the player's score
- change the **CarHealth** by -3 points
- shake the camera for hard hitting impact!

![gaming_MakeCode_Arcade_23.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/659/medium640/gaming_MakeCode_Arcade_23.jpg?1560131940)

## Hitting Hazards

Another type of collision to account for are the trees and oil slicks. These are similar to the car-on-car sprite overlaps.

![](https://cdn-learn.adafruit.com/assets/assets/000/076/668/medium800/gaming_MakeCode_Arcade_24.jpg?1560137089)

## Projectile Hits

When the freeze rays or smoke screens hit an enemy car or bystander car, we'll have them run off to the side of the screen.

If it's an enemy car, the player will gain 300 points; if it's an innocent bystander car, they'll loose 300 points.

![](https://cdn-learn.adafruit.com/assets/assets/000/076/676/medium800thumb/gaming_shootingandhitting.jpg?1560140115)

![](https://cdn-learn.adafruit.com/assets/assets/000/076/672/medium800/gaming_MakeCode_Arcade_25.jpg?1560137602)

Here's how this works:

- check for **sprite of kind**  **Projectile overlaps otherSprite of kind Enemy** (the Bystander loop is similar, but we'll just go over the details of Enemy)
- Play a tone
- **if sprite = freezeray** then destroy the freezeray sprite, and start a **cool radial effect** on the **otherSprite**
- **change CarHealth** by **2** to give the player some health back

### Run off the road

Next, we check if the Enemy sprite is on the left or right half of the screen by using **if otherSprite x \> screen width / 2**

The enemy is then launch off to the appropriate side at the speed of the scene with **set otherSprite velocity to vx 60 vy sceneSpeed**

Since the **enemyA** car already has a regularly updating loop using **vx** to steer it toward the player car, we need to flip the **enemyAShot** variable to **1** , which prevents the steering from activating, allowing it to careen off the road.

This same process happens with the **smoke** sprite type, but using the **warm radial** effect instead.

## Custom Health Meter

We'll get pretty fancy with the user interface (UI) here and create our own custom health meter. The player starts with 100 points of health, each bump with an enemy car or tree removes a few points, and each successful hit of an enemy adds back a few points.

In order to display this visually, we'll use the custom meter graphic and a number of **if...if else** logic tests -- as the health reaches each 10 point threshold we'll display an associated version of the graphic.

![](https://cdn-learn.adafruit.com/assets/assets/000/076/677/medium800/gaming_MakeCode_Arcade_26.jpg?1560140380)

## Game Over

When the **CarHealth** value reaches **0** it's game over!

![](https://cdn-learn.adafruit.com/assets/assets/000/076/681/medium800/gaming_MakeCode_Arcade_29.jpg?1560141055)

Now, you can play the game in your browser, upload it to the PyGamer or PyBadge, or even start making your own modifications to the game!

https://youtu.be/v23MDNK76Uc

# Re-MakeCode the Classics: Py Hunter

## Update the PyBadge/PyGamer Bootloader

You are at the bleeding edge of handheld, open source, game playing hardware and software, what with your PyBadge/PyBadge LC or PyGamer! Congratulations! It's fun and exciting! It is also changing and improving all the time, so please update your bootloaders before proceeding to put your MakeCode Arcade games on the board!!

Info: 

## PyBadge/PyBadge LC Bootloader

If you have a **PyBadge** or **PyBadge LC** , [please go to this page for instructions on updating the bootloader.](https://learn.adafruit.com/adafruit-pybadge/updating-the-bootloader)

![gaming_pyb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/276/medium640/gaming_pyb.jpg?1559330072)

## PyGamer Bootloader

If you have a **PyGamer** , [please go to this page for instructions on updating the bootloader.](https://learn.adafruit.com/adafruit-pygamer/updating-the-bootloader)

![gaming_pyg.jpg](https://cdn-learn.adafruit.com/assets/assets/000/076/277/medium640/gaming_pyg.jpg?1559330110)

Danger: 

## Hardware Checks

If, after updating your board's bootloader, you still think you may have a hardware problem, here's a great way to test out all of the functions. From buttons, to the light sensor, thumbstick (PyGamer only), accelerometer (PyGamer and PyBadge only, not the LC), and more, we've got a super nifty set of hardware test .UF2 files you can use.

Click on the link for your board below for more info and a link to the appropriate UF2 file.

[PyBadge/PyBadge LC Hardware Check](https://learn.adafruit.com/adafruit-pybadge/arduino-test)
[PyGamer Hardware Check](https://learn.adafruit.com/adafruit-pygamer/arduino-test)
Another way to do a hardware check is with the handy, dandy MakeCode Arcade Basic Hardware Test. This was created with MakeCode Arcade and you can use it to check that your d-pad buttons or thumb joystick can move the yellow face around the screen, and that the A and B buttons work to play a sound (just make sure you have a speaker plugged in to the PyGamer first).

You can [open this link](https://makecode.com/_icwXcg4PWRYW) to get to it, or download the UF2 file below and drag it onto your board's USB drive in bootloader mode.

[arcade-Basic-Hardware-Test.UF2](https://cdn-learn.adafruit.com/assets/assets/000/076/316/original/arcade-Basic-Hardware-Test-PyBadge_and_PyGamer.uf2?1559345409)
![](https://cdn-learn.adafruit.com/assets/assets/000/076/317/medium800/gaming_hwtest.png?1559345457)

# Re-MakeCode the Classics: Py Hunter

## Load a MakeCode Game on PyGamer/PyBadge

Let's load a game! For example, here's a link to **Run, Blinka, Run!&nbsp;** To open the game in the MakeCode Arcade editor, first, click the share link below. This will allow you to play the game in the browser right away.

[Makecode Arcade Game: Run, Blinka, Run!](https://makecode.com/_Y90aTaiHfh41)
Then, click on the&nbsp;Show Code&nbsp;button in the upper left corner. The shows the code for the game, and by clicking the&nbsp;Edit&nbsp;button in the upper right corner, it'll open into the editor where you can upload it to your PyGamer/PyBadge.

Once you have a game working on the MakeCode Arcade web editor, it's time to download it and flash it onto your board.

![adafruit_products_Run_Blinka_Run__-_Microsoft_MakeCode_2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/777/medium640/adafruit_products_Run_Blinka_Run__-_Microsoft_MakeCode_2.jpg?1564457638)

![adafruit_products_Run_Blinka_Run__-_Microsoft_MakeCode_3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/778/medium640/adafruit_products_Run_Blinka_Run__-_Microsoft_MakeCode_3.jpg?1564457679)

Primary: 

## Board Definition

In order to load a game made in MakeCode Arcade onto the PyBadge, first choose the proper board definition inside of MakeCode. Click the ellipsis (...) next to DOWNLOAD and then the **Choose Hardware** item.

![adafruit_products_MakeCode_choose_hardware.jpg](https://cdn-learn.adafruit.com/assets/assets/000/108/981/medium640/adafruit_products_MakeCode_choose_hardware.jpg?1644859647)

## Change Board screen

Click on the image of your board, either the PyBadge/PyBadge LC or the PyGamer

![adafruit_products_MakeCode_Arcade.jpg](https://cdn-learn.adafruit.com/assets/assets/000/078/781/medium640/adafruit_products_MakeCode_Arcade.jpg?1564458209)

This will cause the game .uf2 file for your particular board to be saved to your hard drive. You only need to do this the first time you use a new board. Thereafter you can simply click the **Download** button on the MakeCode Arcade editor page.

![](https://cdn-learn.adafruit.com/assets/assets/000/074/943/medium800/gaming_downloaded.png?1556169879)

Danger: 

## Bootloader Mode

Now, we'll put the board into bootloader mode so we can drag on the saved .uf2 file. On the back side of the board you'll see a reset button at the top. Make sure the board is plugged into your computer via USB with a USB micro B to A data cable. Also, be sure the board is turned on.

&nbsp;

Then, press the reset button. This will initiate bootloader mode.

&nbsp;

When the board is in bootloader mode you'll see a screen similar to this one show up.

![gaming_IMG_5427.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/945/medium640/gaming_IMG_5427.jpg?1556170490)

![gaming_IMG_5428.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/991/medium640/gaming_IMG_5428.jpg?1556308393)

![gaming_IMG_5429.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/992/medium640/gaming_IMG_5429.jpg?1556308428)

## Drag and Drop

Now that the board is in bootloader mode, you should see a **BADGEBOOT** drive show up on your computer as a USB flash drive. Simply drag the arcade game .uf2 file onto the drive.

![gaming_dragtoPyBadge.jpg](https://cdn-learn.adafruit.com/assets/assets/000/074/944/medium640/gaming_dragtoPyBadge.jpg?1556308458)

## Play!

That's all there is to it! Once the file is copied over the board will restart and launch the game!

![](https://cdn-learn.adafruit.com/assets/assets/000/074/948/medium800/gaming_IMG_5430.jpg?1556170587)

https://youtu.be/au5w1sLjsaU

Keep an eye on Adafruit.com for additional game related content.

# Re-MakeCode the Classics: Py Hunter

## Troubleshooting MakeCode Arcade

If you run into trouble with MakeCode Arcade, here are some resources for getting help:

- [Microsoft MakeCode Arcade Forum](https://forum.makecode.com/c/Share-your-Arcade-projects-here)
- [Adafruit MakeCode Forum](https://forums.adafruit.com/viewforum.php?f=64)
- [Microsoft MakeCode Arcade Discord](https://aka.ms/makecodecommunity) -- look for the #arcade channel
- [Adafruit MakeCode Discord](https://adafru.it/discord) -- look for the #makecode channel

Primary: 


## Featured Products

### Adafruit PyGamer Starter Kit

[Adafruit PyGamer Starter Kit](https://www.adafruit.com/product/4277)
**Please note: you may get a royal blue _or_ purple case with your starter kit (they're both lovely colors)**

What&nbsp;fits in your pocket, is fully Open Source, and can run CircuitPython, MakeCode Arcade or Arduino games you write yourself? That's right,...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4277)
[Related Guides to the Product](https://learn.adafruit.com/products/4277/guides)
### Adafruit PyGamer for MakeCode Arcade, CircuitPython or Arduino

[Adafruit PyGamer for MakeCode Arcade, CircuitPython or Arduino](https://www.adafruit.com/product/4242)
What&nbsp;fits in your pocket, is fully Open Source, and can run CircuitPython, MakeCode Arcade or Arduino games you write yourself? That's right, it's the **Adafruit PyGamer!** We wanted to make an entry-level gaming handheld for DIY gaming, and maybe a little...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4242)
[Related Guides to the Product](https://learn.adafruit.com/products/4242/guides)
### Adafruit PyGamer Acrylic Enclosure Kit

[Adafruit PyGamer Acrylic Enclosure Kit](https://www.adafruit.com/product/4238)
You've got your PyGamer, and you're ready to start jammin' on your favorite arcade games. You gaze adoringly at the charming silkscreen designed by Ada-friend PaintYourDragon.&nbsp;The nostalgia is palpable!

Cradling the PCB in your hands, you realize there's something...

In Stock
[Buy Now](https://www.adafruit.com/product/4238)
[Related Guides to the Product](https://learn.adafruit.com/products/4238/guides)
### Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino

[Adafruit PyBadge for MakeCode Arcade, CircuitPython, or Arduino](https://www.adafruit.com/product/4200)
What's the size of a credit card and can run CircuitPython, MakeCode Arcade or Arduino? That's right, its the **Adafruit PyBadge!** We wanted to see how much we could cram into a ​3 3⁄8 × ​2 1⁄8 inch rounded rectangle, to make an all-in-one dev board with...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4200)
[Related Guides to the Product](https://learn.adafruit.com/products/4200/guides)
### Adafruit PyBadge LC - MakeCode Arcade, CircuitPython, or Arduino

[Adafruit PyBadge LC - MakeCode Arcade, CircuitPython, or Arduino](https://www.adafruit.com/product/3939)
What's the size of a credit card and can run CircuitPython, MakeCode Arcade or Arduino even when you're on a budget? That's right, it's the&nbsp; **Adafruit PyBadge LC!** &nbsp;We wanted to see how much we could cram into a ​3 3⁄8 × ​2 1⁄8 inch...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3939)
[Related Guides to the Product](https://learn.adafruit.com/products/3939/guides)
### Lithium Ion Polymer Battery with Short Cable - 3.7V 350mAh

[Lithium Ion Polymer Battery with Short Cable - 3.7V 350mAh](https://www.adafruit.com/product/4237)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 350mAh for a total of about 1.3 Wh. If you need a larger (or smaller!) battery, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4237)
[Related Guides to the Product](https://learn.adafruit.com/products/4237/guides)
### Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt

[Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt](https://www.adafruit.com/product/4227)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4227)
[Related Guides to the Product](https://learn.adafruit.com/products/4227/guides)
### Pink and Purple Braided USB A to Micro B Cable - 2 meter long

[Pink and Purple Braided USB A to Micro B Cable - 2 meter long](https://www.adafruit.com/product/4148)
This cable is&nbsp;super-fashionable&nbsp;with a woven pink and purple Blinka-like pattern!

First let's talk about the cover and over-molding. We got these in custom colors, and if you&nbsp;_have_&nbsp;to have visible cables, then you might as well have the nicest fabric-bound...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/4148)
[Related Guides to the Product](https://learn.adafruit.com/products/4148/guides)

## Related Guides

- [Adafruit PyBadge and PyBadge LC](https://learn.adafruit.com/adafruit-pybadge.md)
- [Introducing Adafruit PyGamer](https://learn.adafruit.com/adafruit-pygamer.md)
- [MakeCode Arcade Platformer Level Design](https://learn.adafruit.com/makecode-arcade-platform-level.md)
- [PYOA for PyGamer/PyBadge - Adding Cursor Support to CircuitPython](https://learn.adafruit.com/cursor-for-circuitpython.md)
- [Saving CircuitPython Bitmaps and Screenshots](https://learn.adafruit.com/saving-bitmap-screenshots-in-circuitpython.md)
- [How to train new TensorFlow Lite micro speech models](https://learn.adafruit.com/how-to-train-new-tensorflow-lite-micro-speech-models.md)
- [Next Level MakeCode Arcade Games](https://learn.adafruit.com/next-level-makecode-arcade-games.md)
- [PixelDust Digital Sand Demos for Arcada](https://learn.adafruit.com/pixeldust-digital-sand-demos-for-arcada.md)
- [PyGamer Marble Labyrinth in MakeCode Arcade](https://learn.adafruit.com/pygamer-marble-labyrinth-in-makecode-arcade.md)
- [CircuitPython Stage game library](https://learn.adafruit.com/circuitpython-stage-game-library.md)
- [Creating Your First Tilemap Game with CircuitPython](https://learn.adafruit.com/creating-your-first-tilemap-game-with-circuitpython.md)
- [Playing Arduboy Games on Arcada](https://learn.adafruit.com/playing-arduboy-games-on-arcada.md)
- [Submitting Games to MakeCode Arcade Front Page](https://learn.adafruit.com/submitting-games-to-makecode-arcade-front-page.md)
- [CircuitPython Turtle Graphics](https://learn.adafruit.com/circuitpython-turtle-graphics.md)
- [Crickit Controlled Animatronic Eyeball](https://learn.adafruit.com/crickit-controlled-animatronic-eyeball.md)
