Skip to content

Instantly share code, notes, and snippets.

@sunjon
Created April 14, 2019 17:08
Show Gist options
  • Save sunjon/7b29f553754eb5177466dea362d8c030 to your computer and use it in GitHub Desktop.
Save sunjon/7b29f553754eb5177466dea362d8c030 to your computer and use it in GitHub Desktop.
pico-8 cartridge // http://www.pico-8.com
version 4
__lua__
pallete = {1, 13, 12, 6, 7}
ellipse_rad_x = 30
ellipse_rad_y = 10
velocity = 0
gravity = 0.98
posy = 1
function _draw()
cls()
-- bounce
velocity += gravity
posy += flr(velocity)
if posy >= 76 then
velocity *= -1
end
-- draw circles
local i
local a=time()*0.2
for i=0,0.8,0.2 do
local x = ellipse_rad_x*cos(a+i)
local y = ellipse_rad_y*sin(a+i)
local radius = ((y +10) / 20) * 10
local col = ceil((i*5)+1) -- wtf do i need to use ceil here?
circfill(x+64, y+posy, radius, pallete[col])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment