# Trash Panda: The Game

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/077/017/medium800/gaming_trashPandaLogoBlowup.png?1560526956)

https://youtu.be/et0Pn3pUBuI

Trash Panda is everyone's favorite button mashing, brick dodging, crow avoiding, building climbing, pizza snarfing raccoon game! OK, we just made it, so maybe it isn't everyone's favorite _just_ yet, but we think soon it will be!

Learn to create your own exciting action game [_based on actual real-life events_](https://www.nytimes.com/2018/06/13/us/mpr-raccoon-building-climb.html). You'll use MakeCode Arcade to craft the game, learning how to center the camera using null locators, spawn randomly timed obstacles, pizza power-ups, and set up button mashing input.

Get Lynn the Trash Panda to the top of the building as fast as you can to save the day!

## Parts
### 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)

### Plastic Button Caps For Square Top (10-pack) - 8mm Diameter

[Plastic Button Caps For Square Top (10-pack) - 8mm Diameter](https://www.adafruit.com/product/4228)
These Reese's Piece's lookin' bits fit perfectly on top of tactile buttons with 2.4mm square tops and give a satisfying 8mm diameter surface area for your fingers to press.  
  
You get 10 candy-colored round caps. You get two of each color: **red, yellow, white,...**

In Stock
[Buy Now](https://www.adafruit.com/product/4228)
[Related Guides to the Product](https://learn.adafruit.com/products/4228/guides)
![Angled shot of 10 plastic button caps colored reddish-orange, yellow, white, and black.](https://cdn-shop.adafruit.com/640x480/4228-04.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...

In 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)

### 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...

In 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)

# Trash Panda: The Game

## Trash Panda Setup

## 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 intermediate-level techniques, check out:

- [Re-MakeCode the Classics: _Arkanoid_](https://learn.adafruit.com/re-makecode-the-classics-arkanoid/overview)
- [Re-MakeCode the Classics: _Py Hunter_](https://learn.adafruit.com/re-makecode-the-classics-spy-hunter/overview)

Primary: 

## _Trash Panda_

To begin with, let's load the finished version of MakeCode Arcade _Trash Panda_ and try it out.

![](https://cdn-learn.adafruit.com/assets/assets/000/077/081/medium800/gaming_arcade-TrashPanda.png?1560564764)

Start by launching [MakeCode Arcade beta](https://arcade.makecode.com/beta) using the Google Chrome web browser. Then, download the **arcade-TrashPanda.png** file above by right-clicking on the image below 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 _Trash Panda_ png file.

This will open the code into the MCA editor.

![gaming_MakeCode_Arcade_3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/032/medium640/gaming_MakeCode_Arcade_3.jpg?1560547675)

![gaming_MakeCode_Arcade.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/033/medium640/gaming_MakeCode_Arcade.jpg?1560548224)

Info: 

## Play It

Try out the game! As Lynn the Trash Panda, you need to mash the A or B button to climb the right or left side of the building. Avoid the falling bricks and flying crows -- they'll bump Lynn down the building a bit and she'll lose one heart!

If you see a delicious, huge slice of pizza one of the building dwellers has set on an open window sill, eat it! You'll gain one heart back.

Reach the top and you win the game -- the quicker you do so, the higher your score. This game is hard, so practice to get really good!

## How it Works

Now, let's look at how it works. Some sections are similar to the previous games we've built, so we'll look at those only briefly, and got into more detail on the new techniques used.

## On Start

In the **on start** block we'll first call the function named **Intro**. Here, we set the background image to act as a game title/splash screen.

Then, we call another function called **bgm** (background music) to loop four times with the **repeat 4 times** loop.

The **bgm** function contains the **play tone** and **rest** blocks of a startup song.

Next, we pause for a second and then give the player two screens of instructions using the **show long text** blocks, which must be advanced by pressing the **A** button.

![gaming_MakeCode_Arcade_2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/034/medium640/gaming_MakeCode_Arcade_2.jpg?1560548381)

![gaming_MakeCode_Arcade_3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/035/medium640/gaming_MakeCode_Arcade_3.jpg?1560549374)

## Background and Tile Map

Next, we'll **set background image** to a city skyline, and then **set tile map**.

The tile map will act the same as a scrolling platformer map, except vertically rather than horizontally as we did in the [Ruby platformer game](https://learn.adafruit.com/makecode-arcade-platform-level).

Each index color block is used to place a different tile and in some cases will also be the spawn point for sprite characters, enemies, and food.

We'll look at these individual tiles in a moment.

![gaming_MakeCode_Arcade_4.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/036/medium640/gaming_MakeCode_Arcade_4.jpg?1560549510)

![gaming_MakeCode_Arcade_5.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/037/medium640/gaming_MakeCode_Arcade_5.jpg?1560549857)

## Goal Setup

The goal is for Lynn to climb to the top of the building. We'll place sprites on some of the tile map positions to represent the UBS logo at the top of the building, as well as generic looking yellow and red building sprites that will be on the actual blocks the character needs to overlap to win.

![gaming_MakeCode_Arcade_6.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/038/medium640/gaming_MakeCode_Arcade_6.jpg?1560550225)

![gaming_MakeCode_Arcade_7.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/039/medium640/gaming_MakeCode_Arcade_7.jpg?1560550231)

![gaming_MakeCode_Arcade_8.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/040/medium640/gaming_MakeCode_Arcade_8.jpg?1560550238)

![gaming_MakeCode_Arcade_9.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/041/medium640/gaming_MakeCode_Arcade_9.jpg?1560550247)

## Level Setup

In the **levelSetup** function we'll place the rest of the tiles. Have another look at the tile map to see where each of these images is being placed.

![gaming_MakeCode_Arcade_10.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/042/medium640/gaming_MakeCode_Arcade_10.jpg?1560550331)

## Lynn Character Setup

Now we'll set up the main character, Lynn the Trash Panda. This one is big, so we'll look at it in a few sections.

First, we'll create the **Lynn** character sprite and set her lives to **7,** and then place her x/y position and z depth.

We'll have her appear on top of the blue tile on the tile map.

So that there is gravity in the scene for her to fight, we'll **set Lynn ay (acceleration y) to 200**.

&nbsp;

![gaming_MakeCode_Arcade_11.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/043/medium640/gaming_MakeCode_Arcade_11.jpg?1560551395)

![gaming_MakeCode_Arcade_12.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/044/medium640/gaming_MakeCode_Arcade_12.jpg?1560551425)

![gaming_MakeCode_Arcade_15.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/045/medium640/gaming_MakeCode_Arcade_15.jpg?1560551494)

![](https://cdn-learn.adafruit.com/assets/assets/000/077/047/medium800/gaming_lynn_climb_R.gif?1560551721)

## Lynn Animation

Next up are Lynn's climbing animation and idle animation cycles. We'll create one set facing left (when she's on the right of the building) and one facing left.

We'll also set a single frame animation of Lynn when she's idle. This way we can switch between idle and climbing easily when the player is or isn't pressing one of the buttons.

![gaming_MakeCode_Arcade_13.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/046/medium640/gaming_MakeCode_Arcade_13.jpg?1560551704)

![gaming_MakeCode_Arcade_14.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/048/medium640/gaming_MakeCode_Arcade_14.jpg?1560551762)

## Camera Nulls

The next thing we'll do is a bit tricky. We will need to trick the camera into following Lynn as she climbs the building, but not keep her in the center of the frame, which is the default behavior for the **camera follow sprite** block.

Instead, we want to center the camera with a 35 pixel offset to the left or right, depending on if she's on the right or left side of the building.

This will keep the building from seeming like it's jumping around the scene.

To do this, we'll create a pair of sprites to follow that we'll consider as transform nulls. They will be set to move with Lynn, but with their own relative offset on the x-axis.

These will be invisible during gameplay, but to help us visualize them and understand the concept, we'll create one set of them that have marker graphics, and another set that's invisible. By flipping the **false** to **true** in the **if...else** logic loop, we can turn on (or off) these visualization markers.

![gaming_MakeCode_Arcade_16.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/050/medium640/gaming_MakeCode_Arcade_16.jpg?1560552720)

![gaming_nulls.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/051/medium640/gaming_nulls.jpg?1560552748)

## Pizza Time

It gets pretty tiring to climb a big, tall building when you're a sweet little trash panda. Thankfully, a thoughtful human will place a giant slice of pizza out of a randomly selected window for Lynn to eat!

In this function we'll set up the food, make a pizza slice sprite with a z depth of 1, and then use the **place pizza on top of random white tile** block to have it appear on one of the white tiles in the tile map.

![gaming_MakeCode_Arcade_17.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/052/medium640/gaming_MakeCode_Arcade_17.jpg?1560553126)

![gaming_MakeCode_Arcade_18.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/053/medium640/gaming_MakeCode_Arcade_18.jpg?1560553140)

## Various Variables

These are the last few **on start** blocks to take care of. First, we'll set the **center camera** position. (Later the Lynn nulls will take care of this).

Then, we set up some variables for gameplay (we'll see how these are used momentarily:

- **dropBricks = true**
- **sendCrows = true**
- **goalMet = false**
- **GameOn = true**

**activate animation Idle\_Right on Lynn** sets her in the ready position for game start.

Then, we'll **set score to 1000** -- as the game progresses, this number will be counting down, so that the player's score is based on how quickly they reach the goal.

![gaming_MakeCode_Arcade_19.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/054/medium640/gaming_MakeCode_Arcade_19.jpg?1560553554)

# Trash Panda: The Game

## Trash Panda Game Play

## Climbing Action

At heart, Trash Panda is a button mashing game! So let's set up some buttons to mash.

**on A button pressed** will be for climbing on the right side of the building and **B** on the left.

To prevent button presses during the splash screen from doing anything, such as playing unexpected sounds, we'll first check to see if the **GameOn** variable is true.

Then, we check to see if the **goalMet** variable is false. (This way, the buttons will stop working when Lynn reaches the top and the **goalMet** variable is flipped to **true.** )

The **A** button will move Lynn's horizontal (x) position to **180** , and the **B** button to **110** , which represent the two sides of the building.

Next, her velocity on y is set to -45, which is a boost in the vertical direction. Remember, we already set her acceleration on y to 200, so gravity will be constantly fighting against her. Press quickly to ascend! Her **activate animation** block will cause her to cycle through the climbing animation frames. Note the **on game update** block used to return her to Idle animation cycle when she isn't climbing in the y direction.

Now, we'll use our **camera follow sprite** block with the two offset nulls we created during the Lynn setup function. **A** button follows the **Lynn\_offset\_Right** null sprite and **B** the **Lynn\_offset\_Left** null sprite. Note the **on game update block** used to adjust the nulls to keep them in sync with Lynn's x position with offsets.

Lastly, we'll play a little two note climbing sound.

![gaming_MakeCode_Arcade_20.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/058/medium640/gaming_MakeCode_Arcade_20.jpg?1560557035)

![gaming_MakeCode_Arcade_21.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/062/medium640/gaming_MakeCode_Arcade_21.jpg?1560557052)

![gaming_MakeCode_Arcade_22.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/063/medium640/gaming_MakeCode_Arcade_22.jpg?1560557086)

## Pizza Power Up

When Lynn needs a power up, she can grab a slice! **on sprite of kind Player overlaps otherSprite of kind Food** will take care of noting when the collision occurs.

In this block we'll use **destroy other Sprite**  **with hearts effect for 500 ms** to get rid of the pizza, **change life by 1** to power up the hearts, and **play sound ba ding until done.**

![gaming_MakeCode_Arcade_23.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/064/medium640/gaming_MakeCode_Arcade_23.jpg?1560557630)

## Scoring

The faster Lynn makes it to the top, the higher the score! In order to calculate the score, we'll use **on game update every 50 ms** block.

It will first check that the **goalMet** variable is **false.**

Then, it will **change scory by -1** point from the initial value of **1000**.

Not only does this determine the score, but it's also a countdown timer! By adding the **if score \< 1 then ... game over lose** blocks we can cause the game to end if the player takes too much time.

&nbsp;

&nbsp;

![gaming_MakeCode_Arcade_24.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/065/medium640/gaming_MakeCode_Arcade_24.jpg?1560558902)

## Bricks Keep Falling on My Head!

There are two kinds of enemies in _Trash Panda **--** _ falling bricks and flying crows. They work in nearly the same way, with a few adjustments. We'll look at the bricks first.

To begin with, **on game update every pick random 600 to 1200 ms** gives us a bit of variability to when bricks will fall.

Then, we check **if dropBricks = true** to see if the game has started and bricks are allowed to fall.

**for element value of array of all pink tiles...do** is a way of iterating through a list. In this case, there are three pink tiles in the tile map at the top of the level. The **for element...** block loops through those three tiles, one at a time.

Per element, the loop will do an **if 10% chance**  **then** check, which randomizes the **true/false** check.

When the percent chance comes up **true,** we **set brick to sprite of kind Enemy** with a brick sprite graphic, and then **on top of value place brick** sets the sprite on top of the currently active element tile.

To drop the brick we **set brick vy to 80,** and we also set it to **destroy on wall** which is what happens if a brick reaches to bottom of the tile map where there is a row of tiles with the **wall** flag turned on.

Lastly, we'll play a descending tone glide from 1320hz to 440hz over the course of 800ms. This is a fancy looking block, because it doesn't yet exist in MakeCode Arcade's **Block** mode -- it was entered over in the **JavaScript** mode.

![gaming_MakeCode_Arcade_25.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/067/medium640/gaming_MakeCode_Arcade_25.jpg?1560560514)

## Crows Fly

We'll make the Crows just as we did the bricks. The main differences here are the tiles from which they spawn on either side of the board, and direction of travel, and the addition of a two frame animation cycle.

![gaming_MakeCode_Arcade_26.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/068/medium640/gaming_MakeCode_Arcade_26.jpg?1560561105)

Info: 

## I've Been Hit!

Here's what happens when Lynn collides with a brick or a crow:

- **on sprite of kind Enemy overlaps otherSprite of kind Player** block senses the collision
- **change otherSprite y by 22** moves **Lynn** down the building a bit, so she looses progress and really needs to scramble to get to the top. Go Lynn!
- **change life by -1** removes one of the player's hearts
- **destroy sprite with rings effect for 200 ms** gets rid of the brick or crow
- **camera shake by 5 pixels for 350 ms** gives the player a good, jolting sense of a strong impact

![gaming_Banners_and_Alerts_and_MakeCode_Arcade.jpg](https://cdn-learn.adafruit.com/assets/assets/000/077/070/medium640/gaming_Banners_and_Alerts_and_MakeCode_Arcade.jpg?1560561408)

## Reaching Goals
![](https://cdn-learn.adafruit.com/assets/assets/000/077/080/medium800/gaming_MakeCode_Arcade_28.jpg?1560562682)

The final element of the game is to determine what happens when Lynn reaches to top of the UBS building!

**on sprite of kind Player overlaps otherSprite of kind Goal Lastly, we'll play a little two note climbing sound** is the block that will check for that collision.

- First, we'll flip the **goalMet** variable to **true.** Based on our previous setup, this will disable the buttons and stop the scoring from counting down anymore
- We'll set Lynn to her Idle pose, and set **acceleration y** and **velocity y** to **0** so she stops moving
- **set dropBricks to false** prevents new brick from spawning

Now, let's get on with some celebration!

- **play sound magic wand until done**
- **show animation theatre chase for 2000 ms** comes from the **Light** extension and will light up a pattern on the PyGamer or PyBadge NeoPixel strip!
- use **repeat** block to flash the **keyLogo** from red to white four times, landing on red.
- **game over ... WIN!**

&nbsp;

https://youtu.be/et0Pn3pUBuI

# Trash Panda: The Game

## 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)

# Trash Panda: The Game

## 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.

# Trash Panda: The Game

## 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 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 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 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...

In Stock
[Buy Now](https://www.adafruit.com/product/3939)
[Related Guides to the Product](https://learn.adafruit.com/products/3939/guides)
### Plastic Button Caps For Square Top (10-pack) - 8mm Diameter

[Plastic Button Caps For Square Top (10-pack) - 8mm Diameter](https://www.adafruit.com/product/4228)
These Reese's Piece's lookin' bits fit perfectly on top of tactile buttons with 2.4mm square tops and give a satisfying 8mm diameter surface area for your fingers to press.  
  
You get 10 candy-colored round caps. You get two of each color: **red, yellow, white,...**

In Stock
[Buy Now](https://www.adafruit.com/product/4228)
[Related Guides to the Product](https://learn.adafruit.com/products/4228/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...

In Stock
[Buy Now](https://www.adafruit.com/product/4227)
[Related Guides to the Product](https://learn.adafruit.com/products/4227/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)
- [Playing Gamebuino META Games on Arcada](https://learn.adafruit.com/playing-gamebuino-meta-games-on-arcada.md)
- [Re-MakeCode the Classics: Py Hunter](https://learn.adafruit.com/re-makecode-the-classics-spy-hunter.md)
- [PyGamer Marble Labyrinth in MakeCode Arcade](https://learn.adafruit.com/pygamer-marble-labyrinth-in-makecode-arcade.md)
- [PyGamer Thermal Camera with AMG8833](https://learn.adafruit.com/pygamer-thermal-camera-amg8833.md)
- [Saving CircuitPython Bitmaps and Screenshots](https://learn.adafruit.com/saving-bitmap-screenshots-in-circuitpython.md)
- [MakeCode Arcade: Sparky Invaders](https://learn.adafruit.com/makecode-arcade-sparky-invaders.md)
- [How to train new TensorFlow Lite micro speech models](https://learn.adafruit.com/how-to-train-new-tensorflow-lite-micro-speech-models.md)
- [Two Player Game System for PyGamer and RFM69HCW Radio Wing](https://learn.adafruit.com/two-player-game-system-for-pygamer-and-rfm69hcw-radio-wing.md)
- [PyGamer NeoPixel Controller](https://learn.adafruit.com/pygamer-neopixel-controller.md)
- [Making a Name Tag in MakeCode Arcade](https://learn.adafruit.com/making-a-name-tag-in-makecode-arcade.md)
- [Trash Panda 2: Garbage Day](https://learn.adafruit.com/trash-panda-2-dumpster-dive.md)
- [NES Emulator for Arcada](https://learn.adafruit.com/nes-emulator-for-arcada.md)
- [Playing Arduboy Games on Arcada](https://learn.adafruit.com/playing-arduboy-games-on-arcada.md)
- [PyGamer MP3 Player with CircuitPython](https://learn.adafruit.com/pygamer-mp3-player-with-circuitpython.md)
- [Yoga Pose Chime](https://learn.adafruit.com/yoga-pose-chime.md)
