A cart that allows you to make sprites compatible with ESPR()
So basically I made a function to add sprites beyond PICO-8's 128 by 128 sprite sheet. Feel free to use this function with credit.
function espr(data,x,y,w,h,flp_x,flp_y)
--[[
data is a list of all the
pixels that make a sprite
the sprites are 8 by 8 pixels
this function can be used
for easily adding new sprites
into the game
]]
list=split(tostr(data))
w=w or 8
h=h or (count(list)/8)
x=x or 0
y=y or 0
local val=0
local backup={}
repeat
add(backup,sget(val%w,val/w))
val+=1
until val==h*w
for pnum,p in pairs(list) do
pnum-=1
if (pnum/w)<h then
if p~=16 then sset(pnum%w,pnum/w,p) end
end
end
sspr(0,0,w,h,x,y,w,h,flp_x,flp_y)
for pnum,p in pairs(backup) do
pnum-=1
if pnum<=w*h then
sset(pnum%w,pnum/w,p)
end
end
end |
So, for example, if I do this:
espr("12,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,12",0,0,17,2) |
It will output this:

P#94122 2021-06-27 03:06 ( Edited 2021-08-06 15:13)
:: Gabe_8_bit
alright, so basically it's just spr() except, instead of there being a sprite number, it's just a string of values that make up the sprite. the values are separated by commas and go from left to right, and up to down.
P#94230 2021-06-30 01:22 ( Edited 2021-06-30 01:25)
:: merwok
Ah I see! You’re copying the value to spritesheet then restoring the original. Thanks for the reply.
One could make a small sprite editor that prints out data as hex numbers + a poke4 call (more efficient than sset), and the restore step could also be a simple 'reload'.
P#94234 2021-06-30 03:49
[Please log in to post a comment]



