PICO-8 enables you to become a computer games programmer without the distractions of a cumbersome IDE or a complex set of libraries and hardware compatibility issues.
This series of posts will take you through various challenges that you might face when starting a PICO-8 project. This time, I am looking at starting a project.
Disclaimer: These are beginners’ guides! There are better ways to do these things, but this will get you started and give you the skills to progress.
In PICO-8 you need two functions before anything will work. With the arrival of tabs in PICO-8 I plave each of these functions in a separate tab.
In tab 0 I place a comment with the game information. I also add the _init() function that runs at the start of the game.
--movement demo --doc_robs, 2018 function _init() end
in tab 1 I place the _update60() function that runs 60 times a second or the _update() if you have a game that requires fewer calculations per second or you are worried about backwards compatibility. The comment at the top is displayed if you hover over the tab, so it can be useful in big projects.
--update function _update60() end
Finally, in tab 3, I place the _draw() function. This is where all the drawing code is placed.
--draw function _draw() end
It’s very important to use these functions for just their intended meaning. So:
- If it appears on the screen it goes in _draw()
- If it needs input or calculations it goes in _update().
That’s it. Our project is ready to go.
The next post will deal with simple movement.