-
-
Save morningtoast/a28e1b00c66a3fa57d9f729d547f9363 to your computer and use it in GitHub Desktop.
Useful sprite draw function for PICO-8 (and maybe Lua in general)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- | |
| -- draws a sprite to the screen with an outline of the specified colour | |
| -- transc is color to use as transparent; default is black (0) | |
| function outline_sprite(n, col_outline,transc x,y, w,h, flip_x,flip_y) | |
| transc=transc or 0 | |
| -- reset palette to black | |
| palt(transc,true) | |
| for c=1,15 do | |
| pal(c,col_outline) | |
| end | |
| -- draw outline | |
| for xx=-1,1 do | |
| for yy=-1,1 do | |
| spr(n,x+xx,y+yy,w,h,flip_x,flip_y) | |
| end | |
| end | |
| -- reset palette | |
| pal() | |
| -- draw final sprite | |
| palt(transc,true) | |
| spr(n,x,y,w,h,flip_x,flip_y) | |
| pal() | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment