Skip to content

Instantly share code, notes, and snippets.

@kometbomb
Last active June 5, 2024 15:39
Show Gist options
  • Select an option

  • Save kometbomb/9a644e9814330ee067b72e051c7d1965 to your computer and use it in GitHub Desktop.

Select an option

Save kometbomb/9a644e9814330ee067b72e051c7d1965 to your computer and use it in GitHub Desktop.
#PutAFlipInIt! #pico8
-- 1. Paste this at the very bottom of your PICO-8
-- cart
-- 2. Hit return and select the menu item to save
-- a slow render gif (it's all automatic!)
-- 3. Tweet the gif with #PutAFlipInIt
--
-- Notes:
--
-- This relies on the max gif length being long
-- enough. This can be set with the -gif_len
-- command line option, e.g.:
--
-- pico8.exe -gif_len 30
--
-- The gif is where it would be when you hit F9.
-- Splore doesn't play nicely with this, you
-- need to save the splore cart locally and load
-- it.
--
-- You might need to remove unnecessary
-- overrides to save tokens. pset() override
-- flips every 4th pset() call.
--
-- This doesn't always play nicely with optional
-- parameters, e.g. when leaving out the color
-- param.
--
-- Name clashes might happen, didn't bother
-- to namespace etc.
function cflip() if(slowflip)flip()
end
ospr=spr
function spr(...)
ospr(...)
cflip()
end
osspr=sspr
function sspr(...)
osspr(...)
cflip()
end
omap=map
function map(...)
omap(...)
cflip()
end
orect=rect
function rect(...)
orect(...)
cflip()
end
orectfill=rectfill
function rectfill(...)
orectfill(...)
cflip()
end
ocircfill=circfill
function circfill(...)
ocircfill(...)
cflip()
end
ocirc=circ
function circ(...)
ocirc(...)
cflip()
end
oline=line
function line(...)
oline(...)
cflip()
end
opset=pset
psetctr=0
function pset(...)
opset(...)
psetctr+=1
if(slowflip and psetctr%4==0)flip()
end
odraw=_draw
function _draw()
if(slowflip)extcmd("rec")
odraw()
if(slowflip)for i=0,99 do flip() end extcmd("video")cls()stop("gif saved")
end
menuitem(1,"put a flip in it!",function() slowflip=not slowflip end)
@gamax92

gamax92 commented Aug 14, 2018

Copy link
Copy Markdown

You can use lua's varargs instead of specifying each parameter to have cleaner wrappers and avoid trying to fix optional parameters

@kometbomb

Copy link
Copy Markdown
Author

Really? I thought that was somehow disabled in Pico-8. Need to check on that, thanks!

@sparr

sparr commented Feb 6, 2020

Copy link
Copy Markdown

Is this available for reposting elsewhere under some license?

@kometbomb

kometbomb commented Feb 7, 2020 via email

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment