Skip to content

Games

Enjoying Games with a Gamepad

Now that you've connected a gamepad, you probably want to enjoy some games—the main purpose of the device! I found some high-quality games that run on the Pico board in KenKen's LCD Game Development with Raspberry Pi Pico, and made it possible to play these games using a gamepad.

The button and joystick assignments for the gamepad are as follows. As mentioned earlier, the actual mapping of each button and analog joystick may differ depending on the model, but this general assignment should work for most cases (excluding the right analog joystick).

  • Left and right analog joysticks ... Up, Down, Left, Right
  • D-pad ... Up, Down, Left, Right
  • A, B, X, Y buttons ... Fire
  • Other buttons ... Start

For wiring, please refer to the [diagram above].

How to Build

  1. Clone the repositories.

    git clone https://github.com/ypsitau/picopacman
    git clone https://github.com/ypsitau/picotetris
    git clone https://github.com/ypsitau/picoinvader
    git clone https://github.com/ypsitau/picohakomusu
    git clone https://github.com/ypsitau/picopegsol
    git clone https://github.com/ypsitau/pico-jxglib
    cd pico-jxglib
    git submodule update --init
    
  2. Move to the directory of the game you want to build and run code . to launch VSCode. When the message box Do you want to import this project as Raspberry Pi Pico project? appears, click [Yes].

  3. The Import Pico Project pane will open. Review the contents and click [Import].

  4. From the command palette, run >Raspberry Pi Pico: Switch Board and select the board you want to use.

  5. From the command palette, run >CMake: Build or press [F7]. When the Select a kit for project combo box appears, select Pico Using compilers:... to build the project.

By default, the ILI9341 is set as the TFT LCD. If you want to use the ST7789, uncomment the //#define USE_ST7789 line in ili9341_spi.c.

Pac-Man

UF2 files

picopacman.jpg

Tetris

UF2 files

picopacman.jpg

Invader Game

UF2 files

picopacman.jpg

Hakoniwa Puzzle

picopacman.jpg

Peg Solitaire

picopacman.jpg