Need Help With Creating a Hitbox

First of all, I want to say bravo to stevensm, who created Whip Targets, which inspired this question. I was (and still am) impressed by the coding here, it's more advanced than what I know.

My primary questions are these:

1. How does the hitbox work without ever showing itself? To elaborate, the player script works as a hitbox for the majority of the time, but changes at the end, and never actually shows the hitbox. How does this work? Whenever I try to do something like this, it always flashes between the hitbox and the desired costume to display.

2. How can I compress pretty much the entire player script into a single forever loop like Steven has? When I try to do something similar, something somewhere always glitches and changes the way it would work if the script was in a separate block.

If you have answers to either of these questions, thank you!

I haven't actually made a hitbox thing, but I recommend storing hitboxes in a list.

Circular hitbox:
Store in a list (X Position, Y Position, Radius)
Use the pythagorean theorem to find the distance between the two hitboxes, and if that is higher than the sum of their radii, then they are not touching.

Square hitbox:
Store the X and Y for two opposite corners.

How so? How would I implement this? Interesting thought, but I'm not sure how to put it to use.

Circle Hitboxes are useful for fighting games, round objects like planets or tires. Square hitboxes are useful for environmental collisions mostly.

Okay, I get that, but could you help me put this to use? The circle hitbox sounds useful for the purpose I want, but I wouldn't know how to actually program it. I've been experimenting, but it's difficult. Perhaps I could send you the program I'm working on?

OR...

Another thing you could do is make a sprite and call it a hitbox, make it either circular or rectangle shaped, and make 2 costumes - one with the circle or rectangle hitbox, and one that doesn't (an empty costume). Make the sprite switch from the circle or rectangle hitbox costume to the empty costume and then back again.

It gives an illusion as if the hitbox isn't there for you or the person viewing it, but it is visible to the sprites in the project.

I've seen people employ this technique in Scratch projects. It's very simple and stuff.

Why an empty costume?

ahem You were saying?

Sorry, must've missed this part.

Also, you could just set the ghost effect to 100. Sprites will still detect it.

Oh, yeah, that too. However, the 2-costume trick (I'm gonna call it that) worked for me in Scratch when I first discovered it in 2018 (The year I joined Scratch) and I've been doing that for a long time now. Even today in Snap!.

It works, but ghost effect is a one time setting, and you don't have to worry about the screen refreshing while the hitbox is showing. The only downside is, it doesn't work with color detection (although that is slow, so...).

I am. I was just at school when I made the reply so I couldn't make it.

https://snap.berkeley.edu/project?user=odysseus_ssb&project=Hitbox
This project has the four blocks I've made for managing round hitboxes:

Hitboxes are stored in a list of three (X, Y, Radius).

Update: There are now eight blocks in total. Enjoy. I think the use case for this rather than the 100 ghost effect is possible speed gain, and easy hitbox manipulation.

This is the sort of thing I was looking for. How do I make this work? I've tried but it just seems to flash between costumes.

Oh wait, I fixed it! Thanks!

Actually the 2-costume trick sadly doesn't work in the Snap! editor. It only works in the Scratch editor.

HOWEVER, you can use @ego-lay_atman-bay's idea for setting the Ghost Mode of the object to 100 or something.

Or so you thought. I managed to get it to work in Snap!, the hitbox costume is invisible during play, you only visually see the costume I want you to see with no flashing, but the script runs it as if it were using the hitbox costume.

The second half of the script is irrelevant, it's just to show that it's enclosed in a forever loop.

Oh, well then.
But the code is a bit different than with Scratch. In Scratch, you could easily use my method to make a hitbox but with Snap, the method doesn't work.

Actually most code from Scratch doesn't work with Snap! and vice versa. It's because they are different versions, and so have different source code, and so are, well, different.

I see. I haven't used Scratch in a decade, so I wouldn't know. At least I figured it out!

Since 2012 or 2011?! Wow.

The Golden Era of Scratch in my opinion is from when 2.0 first came out until the first year when 3.0 came out. That means around (And this is coming from me, not from anywhere else. I started an account and a few projects on Scratch from 2018 to 2021, but I did get to use Scratch in 2015) from 2013 to 2019 was the Golden Era of Scratch, the best the community and website has ever seen.

And no, I'm not trying to complain about Scratch for the 3rd time.

So yeah, my point: The golden era for Scratch was from 2013 to 2019, the best the community and website has ever seen. I was part of this era. Truly magical. I feel a bit sad thinking that I joined Scratch during the last of the days.