Invincibility stars fix#356
Conversation
This fixes the scene leak caused by freeing the child node instead of the root node of the RotatingParticle scene for now, ima start with experimenting with the new invincibility stars thingy later..
|
I assume by the fact that this is a draft that you aren't ready for review yet? |
|
I know, but like, should I open it for testing the fix or keep it as a draft till I do smth with the invincibility stars? (Forgot to say this is my first time opening a pull request and contributing to another repository..) |
|
Oh, generally speaking you wouldn't create a PR until you have some kind of fix actually ready unless you were specifically reaching out to a dev for help which is usually what the drafts are for... that or sharing a fix that you aren't adequately sure of and don't mind tossing over the fence should you disappear for someone else to look at. |
|
Well, I just fixed the scene leak, but I'm also trying to implement the invincibility star effect from Sonic 2, even tho it feels like I might need help at this or smth.. maybe no problem with opening the pull request for testing |
|
I tried to eyeball an understanding of what happens with the Sonic 2 invincibility star effect, but it's kinda busy so it's hard to tell the exact details of it. I'll try to work with you on it soon. |
|
From what I can infer, its actually not as complicated as it looks at least on an outer level. It looks like there are four pairs of stars, each one orbiting Sonic with each one beeing offset by where Sonic was a certain number of frames ago, and then there's a scond part to the efect that essentially just spawns stars at a psuedo-random offset at different set intervals. |
|
Huh, I knew there is more to it.. anyways, here's what I've done so far, It's just 8 rotating particles spinning around the player's position in whatever direction it's in, I've deleted the two star generator nodes and replaced them with rotating particle scenes and tweaked some code, I know it's not much progress and there's nothing much to it, I just need to figure out the animations and how to make it follow the player and other stuff.. 2026-06-16.21-34-51.mp4 |
|
Okay, so I guess the invincibility stars in Sonic 2 consists of 4 pairs of stars like @Caverns4 said, and they're spinning around the player in whatever direction the player is facing, with the main pair being locked into the player's position while the other pairs trail behind the player (kinda like afterimages or smth idk), and the rotation and animation of the main pair are faster than the trail pairs, so with this, I brought back the two star generators like normal so that they function like a main pair, even tho I still feel like it shouldn't be in the player scene, and I still gotta figure out how to make the trail pairs by instantiating them when the invincibility monitor is destroyed and freeing them when the invincibility effect is finished.. 2026-06-22.20-15-57.mp4Btw, all this made me rethink of the particle system, since I initially asked for a particle rework cuz I thought having multiple particle objects is a bit redundant, and now idk what to do since the invincibility stars doesn't function like a generic particle.. (btw, I guess the invincibility stars effect is the only thing that uses RotatingParticles, so I deleted every other animation in the RotatingParticle scene and kept the invincibility animation, and did the same for the player's star generators) |
After days of trial and error ~~and procrastination~~, I've finally figured it out, still needs documentation tho, and maybe a bit more cleanup, idk.. anyways, ima rest a bit before attempting at doing the particle system
More adjustments
Corrected the star angles and adjusted the pair offsets (I hope this is the last adjustment or smth..)
|
I'm fine with using a Array[PackedByteArray] for storage of byte data specifically. I'm not as sure about Vector2s. I do think the array should be typed if it's easy to do so, but I'm forgetting a bit about how cleanly array typing works in 4.3 EDIT: Oh, but there's a PackedVector2Array that you can probably use there instead. I reviewed the function of Packed Arrays in general and I'm inclined to say yeah, use them. They make sense. I doubt it's going to be an optimization we really need or anything, but it's fine. |
|
So, I've converted all arrays into packed array types, and I only have a problem with the arrays inside the frame array, for whatever reason, the game just throws a lot of errors saying "index [insert a somehow big number] out of range" or smth.. (also I wanna see the suggestions, honestly lol..) |
I assume you are providing the number somehow right? Got a code snippet? |
|
Here are some snippets of code from the script: Edit: Wait, setting them to packed byte arrays don't throw errors and the stars don't animate, while setting them to int32 arrays instead of byte arrays throws these errors? Also I printed the sizes of the packed arrays and they were somehow incorrect (in byte arrays case, it returns 0, and in int32 arrays case it returns 24 for whatever reason, idk what's going on..) |
|
Nevermind, solved this issue, I just had to construct the arrays with the |
|
|
|
Wait, is it a good idea if I kept it as |
|
Ah, right, you're caching a nested packed array from |
|
Well, I DID wanna replace all arrays with packed ones, but I've changed my mind when you told me not to, but then I asked if I could keep the nested arrays untyped and convert them into packed arrays in the |
A few adjustments and wip documentation (still waiting for the suggestions, btw..)

Trying to fix the invincibility stars, nothing else to say here for now..