Alternatives for removing coins after interacting with them?
Hi, first time here so I hope this is the correct way to do this. I was working a on practice project, attempting to combine different lessons I've learned so far. I made a simple 2d game, where I collected coins, and had a UI to keep track of how many coins I collected. This is the code I used for interacting with the coin and removing it:
I noticed a problem happening when collecting the coins. If I moved fast enough, I could collect the same coin multiple times. I realized that the sound file kept going for about half a second after the sound effect itself ended, which caused the problem. Since I didn't know how to edit a sound file, I searched for a solution in Godot.
I found out about pitch and realized if I cranked the pitch up, it would alleviate the problem, and it definitely seemed to help, but I also ran into one other problem, which is why I'm here. I noticed that if I stayed in the area where the coin spawned, if I moved quickly back and forth, I could keep collecting the coin over and over for a while after it disappeared. I was hoping to figure out why that was happening, and wanted to ask for possible alternatives on how to code removing the coin, so that I can have a more efficient/bugless way to taking out coins in future projects. Thanks.
Posted Jul 26, 2026, 11:38 PM UTC