-
Notifications
You must be signed in to change notification settings - Fork 7
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
Block for get closest and farthest of kind #5
Comments
Hmm @UnsignedArduino could you point me to some examples of doing this real quick? I can see the value in it, just want to see use cases where you'd use it, in case there are other options / factors we can consider; e.g. I could see some use cases could benefit from having 'n' nearest sprites (in which case I'd want to use https://github.com/jwunderl/pxt-heap to find the closest / furthest sprites, which can be done quite efficiently), but that makes the block a little more tedious to use if someone is looking for only one sprite. |
In my tower defense game, I could find the closest enemy or the farthest enemy, or maybe even just checking if there is something within a certain range by checking if a sprite is returned. Or maybe a shark that is trying to eat the closest fish, which wouldn't need a range anyway, so we could pass in
This is also a great idea too, but having a |
( ) |
Hi!
First off, I would like to say that this is an amazing extension. It really simplifies the math needed in complex games!
Anyways, so the main reason I use this block:
is to find the closest or farthest sprite of a certain kind from a sprite. I was thinking of a block like:
and it would return a sprite, or
null
if there aren't any sprites of that kind.number
could be hidden behind a+
sign or you could pass innull
in TypeScript to not have a minimum distance. And also maybe the farthest sprite like this:The text was updated successfully, but these errors were encountered: