From 37d9e3d30e953cce53ae4a6b9410c8922cdb88d7 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sun, 8 Jun 2025 14:10:23 -0700 Subject: [PATCH] more experiments with drawing these collision boxes. still sucks --- collisiontest.p8 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/collisiontest.p8 b/collisiontest.p8 index be7652c..39b47f1 100644 --- a/collisiontest.p8 +++ b/collisiontest.p8 @@ -114,7 +114,7 @@ end function _draw() cls(0) rect(bx0,by0,bx1,by1,6) - zot(lx1,ly1,0,lx1-lx0,ly1-ly0,10,9,8) + quickzot(lx1,ly1,2,lx1-lx0,ly1-ly0,10,9,8) --line(lx0,ly0,lx1,ly1,2) local cmin, cmax = collides() if cmin then @@ -163,6 +163,17 @@ function zot(x,y,r,dx,dy,hot,warm,cold) line(x0,y0,x-i*sdx,y+ry,hot) end end + +function quickzot(x,y,r,dx,dy,hot,warm,cold) + local x0, y0, r2 = x-dx, y-dy, r/2 + rectfill(x0-0.5-r2, y0-0.5-r2, x0+r2+0.5, y0+r2+0.5, cold) + local a = atan2(dx,dy)-0.25 + local tdx,tdy=cos(a), sin(a) + for i=-r*0.65,r*0.65,0.65 do + line(x0+i*tdx, y0+i*tdy, x+i*tdx, y+i*tdy, warm) + end + rectfill(x-r2,y-r2,x+r2,y+r2,hot) +end __gfx__ 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000