Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
midsubspace opened this issue Oct 18, 2023 · 2 comments
Open

Comments

@midsubspace
Copy link

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

@JoeStrout
Copy link
Owner

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

@JoeStrout
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants