Hello, I am currently trying to make an infinite runner in Godot. I want to make it so that when my player touches and destroys (Queue_free) a coin it will add +1 to the score.
However, my player has its’s own script that handles the collisions and the stuff regarding the score is in my world script. I cannot figure out the proper coding to check if a coin has been destroyed by the player. I know how to add to the score, but I can’t figure out what line of coding is needed to check if an object in a group was destroyed by the player.
So what kind of code would I need if I want to check if an object has been destroyed and then add +1 to the score?
I’m new here so if I posted in the wrong area, please let me know where I can go to get the help I need.
Oh I see what you mean. You said you have your collision set up, right? If the collision already works, you can just += 1 to your score variable. I can help you with collision if you don’t have that working yet.
The video really helped a ton. What I ended up doing was making a gameplay node and putting the world script into there. That way I could access it from my player script where the collisions happen and have the score be added there using the add_point() function in the gameplay script.
Thank you all again so much for your help and support!