minimicro-sysdisk icon indicating copy to clipboard operation
minimicro-sysdisk copied to clipboard

Feature Request: Pixel-Perfect Sprite Click as a default function

Open midsubspace opened this issue 2 years ago • 2 comments

add in the follow code as a function to sprites as part of localbounds check maybe or a spriteUTIL that could be imported.

Sprite.overSolidPixel`` = function(pos) x = (pos.x - self.x) / self.scale + self.image.width/2 y = (pos.y - self.y) / self.scale + self.image.height/2 c = self.image.pixel(x,y) text.row = 25 return c[-2:] > "88" end function

Use case would be such as in the blog post at https://dev.to/joestrout/pixel-perfect-sprite-clicks-20dl

midsubspace avatar Oct 18 '23 22:10 midsubspace

If we add something like this, we'll want to be sure it handles rotation and non-uniform scaling, too.

JoeStrout avatar Nov 01 '23 15:11 JoeStrout

Not sure this belongs as a built-in method, and there's not really a good place for it in /sys/lib. Might just write it up as a "How To" article on the wiki.

But see #11, which was inspired by this.

JoeStrout avatar Nov 01 '23 16:11 JoeStrout