Shooting Star

0
0
Published 2023-06-12

Hello, this is my first post here! I've known about PICO-8 and have been around the community for years now, but I finally decided to try learning how to make stuff in it around two months ago.

I got the idea for this cart a couple days ago and could not stop thinking about it, so I started on it yesterday morning and ended up doing it all in one sitting. The idea was to rearrange the screen palette into a gradient (including some colours from the secret palette) and then make draw functions that use pget() and pset() to increase (or decrease) the brightness of pixels when drawing lines and shapes (besides the trail). Basically additive (or subtractive) blending. I knew doing pget() and pset() on so many pixels would be really slow though, so for the noise and gradient across the entire screen, I decided to try doing that directly to the screen memory, using $/peek4() and poke4() to add bits. It had to be in 32-bit chunks, peek/poke 2 or 1 would make it drop below 30fps (maybe possible with better optimization, idk). I think the 8 pixel wide chunks made it look more interesting in the end though!

For the trail, I used p01's trifill function. I had a feeling if I tried to make a function to draw additive blended triangles, performance would be really bad. So I decided to just draw normal filled triangles at the start of the draw cycle and do all the additive stuff after.

I shared a gif/video of this online and lot of people wanted to see the code, so I'm uploading it here! The code is a bit messy and maybe there's some stuff that can be optimized, I'm still fairly new to programming in PICO-8 and don't consider myself amazing at code. I'm very happy with how it turned out through! I'm surprised I was able to pull off all the ideas I had for this, while maintaining 30fps.

I hope any of this is interesting or useful, enjoy!

EDIT: Updated the cart to include music, made for this cart by @muse_energy!