Log In  

A cart that allows you to make sprites compatible with ESPR()

Cart #espr_maker-0 | 2021-07-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

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


 w=w or 8
 h=h or (count(list)/8)

 x=x or 0
 y=y or 0

 local val=0

 local backup={}

 until val==h*w
 for pnum,p in pairs(list) do
  if (pnum/w)<h then
   if p~=16 then sset(pnum%w,pnum/w,p) end
 for pnum,p in pairs(backup) do
  if pnum<=w*h then

So, for example, if I do this:


It will output this:

P#94122 2021-06-27 03:06 ( Edited 2021-08-06 15:13)

Can you explain more how to use this? Where does the function "add" or "output" sprites?

If you’re open for some optimization ideas:

  • use hex notation for colours rather than decimal
  • pack two pixels in one byte
P#94178 2021-06-28 14:35

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)

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

I made a cart that allows you to make Extra Sprites @merwok

P#94314 2021-07-01 21:23

I don’t get how that message replies or addresses the ideas in my last message.

P#96179 2021-08-18 13:42

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2022-12-09 03:16:49 | 0.019s | Q:17