Need Help With Creating a Hitbox

Yeah, that kinda sucks. But now Snap! is just being weird with the way I've coded collisions, it changes depending on whether or not I have the stage minimized or maximized. Well, I guess this is another scrap.

You can always use my system. It's completely math based, and the inconsistency with the touching based system are probabbly caused by the sprites scaling alongside the window (although I don't know).

Snap! Object Detection is completely pixel-perfect. So things might break here and there.

Still, I don't get it. The way I have it set up, it really shouldn't matter whether or not it's pixel perfect. In fact I designed it in an attempt to make it as pixel perfect as possible, so there are no gaps or overlaps with the walls. The stage size and sprite size are calculated out to be perfectly flush. The way I have it, when the tank touches the wall, depending on where it is in relation to said wall, it will be prevented from moving farther into the wall, and that's pretty much it. So why on earth should it work in one direction over the other, and why should the resolution of the stage change that? The sprites still have edges that are singular pixels wide, as far as I know. I'm sorry, this one is just bugging me.

What I would do is create a new sprite, with the costume of that sprite being a custom square that fits around the player sprite, and then set it's "ghost" effect to (100) so it is not seen, and since it is not hidden, it is technically still able to interact with all other objects. Then I attach it to the player forever.

Don't worry, I've got it figured out. Thanks for your input though :slight_smile:

How did you figure it out?

I just made a circular costume for the tank and had the collision part of the script run while that costume is used. Then it changes at the end to the regular costume and for some reason that works.

Can you send an example script :smiley:

image

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.