PicoJS is a tool to 'pack' and 'unpack' .p8 files so that you can more easily work on them in other editors / programs.
Assuming you have node installed:
npm install
tsc
npm link
Following these steps should link the generated dest/app.js
to the command picojs
PicoJs assumes that your .p8 file is in a directory specifically for that game or project. E.g. dungeongame/dungeongame.p8
Unpacking is the process of taking the .p8 file and breaking it up into its component parts.
Go to the directory containing your .p8 file and type picojs unpack
.
This will create the following subfolders and files where <FILENAME>
is the name of your .p8 file with the file ending removed. E.g. dungeongame.p8
-> dungeongame
:
src/lua/<FILENAME>.lua
: the code of your p8 game.src/spritesheet/<FILENAME>_ss.png
: the spritesheet rendered as a png.src/map/<FILENAME>_map.json
: the map as a json file.
Pack reverses the process and composes the component files in the locations generated by unpack back into a .p8 file.
To pack, simply: picojs pack
in the folder containing your .p8 file.
Will create a new .p8 file as well as the subfolders and files created by the unpack
command. The .p8 file will be named the directory name. E.g. if you run picojs init
in a directory named dungeongame
then the created .p8 file will be dungeongame.p8
.