I created this after seeing Chance and Control, an exhibition from the V&A that visited Chester in 2019. At the time I was experimenting with PICO-8 and making some simple games, but thought I would use it for a quick idea inspired from the exhibition.
The program simply draws pixels to the screen to create a night sky effect, but there is a one in a million chance that a ‘shooting star’ will be drawn. (At the moment this is just a different coloured pixel, but I will also look into animating it.)
The update and draw functions fire 30 times a second, meaning there are 2,592,000 updates in 24 hours. Therefore you should see a shooting just over twice a day on average.
PICO-8 uses a lua based language:
function _init()
cls()
end
function _update()
define_pixel()
end
function _draw()
draw_pixel()
end
function define_pixel()
pixel = {}
pixel.x = rnd(127)
pixel.y = rnd(127)
star = flr(rnd(20)) + 1
shootingstar = flr(rnd(1000000)) + 1
if shootingstar == 1 then
pixel.col = 14
else
if star == 1 then
pixel.col = 6
else
pixel.col = 0
end
end
end
function draw_pixel()
pset(pixel.x, pixel.y, pixel.col)
end
If a shooting star isn’t drawn there is a one in twenty chance a normal star will be drawn, else a black pixel will be drawn to the screen. This was done to slow down the rate of white stars filling the screen, and to create a slight twinkling effect as stars can be replaced.
This also means you could be very unlucky and your shooting star could blink away nearly as quickly as it was drawn.