Ignore how the ship moves and the background. this is just a snipe bit of a game that i might never finish. ________Backstory/Lore________________mso one problem i have with scratches hitboxxes is their very limited. especially when it comes to dealing with damage. you can either 1 put the damage ai in the enemy. this means your game can run with clones and enemys can have their own immunity frames but all your projectiles will have to do the same damage or you would have to make a new sprite for every projectile. or 2 you could put damage in projectiles which allows you to choose how much damage a certain projectile does and when it can and cannot hit a enemy but this comes at a cost of not working with clones since theirs no way to tell which clone you hitting. this has been bothering me since in some of my games i would need projectiles that do a bunch of different damages and it to hit clones but it just couldnt. so i was at school thinking about this then a though came in my head "what if i use a list" and thats where this idea comes from ________What it does and How It Works__________ this hitbox allows for hitting clones. choosing how much damage each projectile does. Changing sizes of the hitbox. These hitboxes work by noting the X, Y, Damage and Hitbox Size Values in a page of a list. then in the enemy sprite it checks (using broadcasting) whether the enemy is closer to the distance of the X and Y cords than the hitboxes distance. if it is in distance then it will return a value saying whether the clone was hit (Rn it just says how much damage was done) Once all the hitboxes have been checked all pages on the list will be deleted ________What's needed for this to work_______ Right now all that is need is some code in projectiles, enemies ("Read if hit" is the sprite name) and the code broadcasting the scan hitboxes in background. ____Problems with this hitbox___________ right now i know of two problems with this it box. 1 is its a bit janky some times and even if a projectile misses the hitbox will still hit. and that there's no way to get a square hitbox since hitboxes are calculated with distance. aside from that it should be perfectly fine
If you ever need a hitbox like this in a game feel free to use this one. well, that's if you can understand my code I might come back and update this if I ever improve the system. anyway, see ya next [insert time period]