Log In  


Two functions to draw outlined sprites (with some help from kreyk29!)

Regular version that does smooth outlines:

function outspr(sp,x,y,w,h,flpx,flpy,out)
 for c=0,15 do
  pal(c,out)
 end
 spr(sp,x+1,y,w,h,flpx,flpy)
 spr(sp,x-1,y,w,h,flpx,flpy)
 spr(sp,x,y+1,w,h,flpx,flpy)
 spr(sp,x,y-1,w,h,flpx,flpy)
 pal()
 spr(sp,x,y,w,h,flpx,flpy)
end

Another version that does square outlines:

function outspr(sp,x,y,w,h,flpx,flpy,out)
 for c=0,15 do
  pal(c,out)
 end
 spr(sp,x-1,y,w,h,flpx,flpy)
 spr(sp,x+1,y,w,h,flpx,flpy)
 spr(sp,x,y+1,w,h,flpx,flpy)
 spr(sp,x,y-1,w,h,flpx,flpy)
 spr(sp,x-1,y-1,w,h,flpx,flpy)
 spr(sp,x+1,y-1,w,h,flpx,flpy)
 spr(sp,x-1,y+1,w,h,flpx,flpy)
 spr(sp,x+1,y+1,w,h,flpx,flpy)
 pal()
 spr(sp,x,y,w,h,flpx,flpy)
end

Example carts:

Cart #watermellon-0 | 2021-06-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


Cart #watermellonsquare-0 | 2021-06-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA



ok


Yes. This is how people do outlined text, usually. Or you can just use one of those extra renders for a shadow.

Question. Why use all these tokens if you can just add the outline to the sprite itself, or just have a second sprite that's just the outline that you can render on top? Choice highlighting? Status effects?


@UnitVector using outline function because sprite can fully cover the sprite cell or all of the sprite cells are used


It works, @Czarlo. What you wrote is one good way to do it. I wrote something recently that could be used in effect for future code if you like:

https://www.lexaloffle.com/bbs/?tid=47010

Actually it would be great if P8SCII had the ability to draw sprites and outlines + shadows additionally. @zep, this would be excellent and help in Tweetcarts. :)



[Please log in to post a comment]