TLDR: I'm having an issue with my game that does not always occur and I can't seem to fix it. Hoping somebody can take a look at it for me to see what I'm doing wrong.
Longer Version:
In the 2D game I'm making, the player flies around collecting orbs of light (up to 10 at a time in the most recent iteration) and depositing them at a designated area or areas where suns should go. If the player deposits the correct number of orbs of the correct color (or pattern of colors), they win. As the game advances, there will be traps and optional enemies to make the game more challenging.
Currently, about 75% of the time, everything works correctly and the game "scores" all of the orbs properly as the sun absorbs them. The other 25% of the time though, the game does not score the orbs properly, and all of the orbs past a certain point simply disappear all at once without counting down the number of orbs required on the UI, or triggering the sun to increase in size or intensity.
The issue can sometimes be hard to recreate, but here's two video examples (sorry for potato quality):
Incase it isn't clear, in the above video, I pick up the max of 12 orbs, but the game only scores half of them. It's much more obvious in the second video.
It does usually work as intended, but when it glitches, it can be game breaking.
I am new to coding, so I've gone through twice now with the guidance of a reddit user and cleaned up my code significantly both visually and by refactoring a great deal, but I still can't seem to figure out the heart of the issue.
Would anyone be willing to download the project file and take a look and see if they can figure out what is going on? If so, let me know and I can send you a link to it.
EDIT: I was going to PM the link to people willing to look , but here it is: https://drive.google.com/open?id=1SAoH13ivxpGmR2zyw7ovAAPjP2eserbT
The relevant files are located under the RevisedScripts folder and are Orb_Rev3, Player_Rev3, and Sun_Rev3.
I'd greatly appreciate it as I'm pulling my hair out trying various things to figure this out to no avail.