im just trying to make collision between sprites and i am… failing i need a system for overlaps that can be applied to any sprite shape, or just.. lines (that are a few pixels thick) that go any direction.
i am aware that this is difficult, and if nobody has a way to do it, i do have a solution, but im not sure if it will work 100% guarenteed.
also, i need the overlap to only detect where pixels are, not just the image size of the sprite.
Oh, also @Sonicblaston made a sprite walls extension that you might want to look at if you haven’t yet. Search Sonicblaston62/Sprite-Walls in the extensions search bar to find it.
“Sprite overlaps Orhersprite” blocks are based on where the pixels are, but the real problem is preventing the moving sprite from going through the other one. This can usually be done by comparing where the two sprites are and “ejecting” the other sprite by pushing it away from the solid one. This can be fairly difficult to do, however.
My best guess as to how I would do it is I would keep track of the moving sprite’s position over time, and only update this tracking position if the sprite is not touching any solid sprites, then if the sprite ever is touching a solid sprite, its position gets moved a little bit at a time back towards its last saved position from when it wasn’t touching the sprite, until it’s no longer touching the sprite. Or use some math to instantly find the point where the sprites aren’t touching, but I think I would just be lazy and go with the tiny movements.
for everyone who is telling me to use the extension. THIS WILL NOT WORK
i already explained that it needs to be applied to any sprite shape, and sprite walls extension does not support this. i have tried it. the owner themself said they will not update the extension to support this because it is too difficult.
the way the extension currently works is through the rectangular hitbox the sprite takes up, not just where the pixels are in the sprite, and in my situation, the sprites image takes up the whole screen, but there are only pixels in part of it.
@WoofWoof 's idea is good, but for what i am trying to make, it would not work.
You said yourself you had a potential solution, yes? We don’t have any other ideas, and we aren’t going to code it for you. Might as well try the solution you have in mind!
i don’t remember what my original idea was but the one that worked was detecting if the color in an image at a location relative to a sprite was a certain color, and if it was, i would push the sprite away from the position it detected the color at. it wont work for all sprites but if the “wall” sprite is being drawn with blocks from the image tab it will usually be one color and this will work well.