Log In  

Please help me understand how screens are drawn in Pico-8. When I first started playing, I thought sprites would be like player missile graphics on my Atari, but it doesn't look like that's the case. It looks like I clear/redraw everything on the screen with the _draw() function. Is that correct?

P#20221 2016-05-06 07:42 ( Edited 2016-05-06 14:58)

You have basicly two way of rendering your game. In the first you doesnt clear each frame (so no cls() in the _draw() function) and you draw your new points/lines/sprites on top of what was here the last frame. This is prety usefull for some special effect's in graphical demo, or in simple game like LightCycle, where you even use the screen as the state of your game. By drawing each frame, you create a maze, and you read the pixel value to see if there is collision.
In the second way of rendering, you clear everything each frame, and need to redraw everything in the _draw() function. This is the standard in most sprite heavy games, like plateformer's. In this method, you can easily use scrolling (with camera() function).
You can sometimes mix the two ways, like in the Shodo cartridge, where you keep the last frame, but can also draw some sprite on top of it that will last only one frame. This way is a lot more trickier.

P#20223 2016-05-06 08:25 ( Edited 2016-05-06 12:25)

Ok, that makes sense! Thanks!

P#20228 2016-05-06 10:58 ( Edited 2016-05-06 14:58)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-02-01 22:18:36 | 0.004s | Q:12