Add a variable to track the score in the Player script
Add a variable to track the score in the Player script
Next we need a function to update our score
Next we need a function to update our score
Now we can:
Now we can:
- Call our add_score function and send it an amount
- Increase the score by that amount
We can decide what happens to increase the score
We can decide what happens to increase the score
For this demo, we will increase the score with each coin collected.
For this demo, we will increase the score with each coin collected.