Setup Pyxel On Ubuntu

Context

Let's play with Pyxel a new retro game engine called Pyxel, built with Python.

Warning: If you're using a Windows or Mac computer, use the Pyxel Install Instructions, instead.

Setup

  1. Install dependencies

    sudo apt install libsdl2-dev python3-pip -y
    
  2. Install Pyxel

    sudo pip3 install -U pyxel
    
  3. Get some examples

    mkdir -p ~/src
    cd ~/src
    pyxel copy_examples
    

Play!

  1. Run a program!

    cd ~/src/pyxel_examples
    pyxel run ./01_hello_pyxel.py 
    
  2. Make a sprite!

    cd ~/src/pyxel_examples
    pyxel edit ./01_hello_pyxel.py 
    

    Be sure to put it in the upper left corner, (0,0)

  3. Edit a program

    cd ~/src/pyxel_examples
    codium .
    

    Let's replace the logo with what we just drew.

    # pyxel.images[0].load(0, 0, "assets/pyxel_logo_38x16.png")
    pyxel.load("./01_hello_pyxel.py.pyxres")
    

    Tip: Notice how this was loading a bitmap into 0,0 which we drew our new drawing into in the previous step.

  4. Run in again!

    pyxel run ./01_hello_pyxel.py 
    
  5. Create a file for the website

    $ mkdir hello
    $ mv ./01_hello_pyxel.py ./hello/         
    $ mv ./01_hello_pyxel.py.pyxres ./hello/         
    $ pyxel package hello ./hello/01_hello_pyxel.py
    added 'hello/.pyxapp_startup_script'
    added 'hello/01_hello_pyxel.py'
    pyxel app2html hello
    

    Now open hello.html in a browser....Like this

    Tip: It will show the Pyxel logo for several moments while it loads.