- Home /
Can add any value to survival score system
I have a script that allows me to convert the distance moved on the z axis into points for our score system. The only problem is that I want to add point to my score int when I collide with our powerups. I've tried everything i can think of but it doesn't work.
Everything pretty much works, but when I collide with a powerup, it won't add the points (500 points in this case), and I have a feeling that it's because I've defined the score to be z position in int in the update method, and can't be changed dynamically if predefined with = operator. I've tried turning "score = 0 + (int)(position.z);" into "score += (int)(position.z);" but the points gets added to fast and adds more and more over time faster and faster. Here is the script if anyone feeling op to helping me out: http://pastebin.com/k18yLM5P
Does you "basic" score system works with position only ?
I think, you should make two different scores : one calculated from the distance, the other from power ups. When you display the total score, just add the two scores.
By the way, you will be able to display the two different scores when the game is over for example, and you want to recapitulate the total score.
Your answer
![](https://koobas.hobune.stream/wayback/20220613200911im_/https://answers.unity.com/themes/thub/images/avi.jpg)