- Home /
Other
How to script and display score
Hi everybody, I'm learning scripting and in my game I need a specific script.
I'm making a game that mashup 3D and 2D scenes.
Ok so, I need a script doing this :
When the player enter a object collider (object tag = Bonus) add 500 points to the total score and destroy the object.
if the object tag is (object tag = Small Bonus), add only 250 points and destroy the object.
If the player die so, restart the level but reset the score to the first time the player entered the level.
Exemple : If the player finish the level 1 with 500 points, start the level 2 with always 500 points obviously, and if he die after picking up some points, restart the level with 500 points. If the player finish the level 1 with 500 points and finish the level 2 with 1000 points, so, start the level 3 with 1500 points. If he die, restart the level with 1500 points... and so on ^^
The score need to be at the top middle and never being destroyed. So if the player change scenes, the score will be always there. That's it.
I need this in JS please, I can learn more easily in JS !
P;S : I'm french, sorry for my bad english.
Unity Answers does not write or find scripts to specification. Unity Answers addresses single specific technical questions to help you write your own code.
I know, but I need help to at least understand how to do this.
I'm looking for help to write my own code. I'm really new to scipting. I'm making the music, the 3D, the 2D Sprites and all the stuff, I only need a little help to be able to script scoring. $$anonymous$$y knowledge in scripting are really weak. I only know some basics atm. But I learn really quick and all my scripts are done by myself. And i'm proud of me. I've even accomplished an IA. But like it's my first time using fixed parameter at load level or even, using GUIText ... I don't know how to proceed !
Try the learn section. The tutorial on persistent data might be relevant. You also want to look up triggers.
Thank you ! :D Didn't know the persistent data ! It's ok for triggers.
Follow this Question
Related Questions
OnTriggerEnter to load new level 1 Answer
calculate playerprefs and display 1 Answer
Score and Level Loading 1 Answer
how to count points for a water bottle flip game 0 Answers
How to increase score on hit 0 Answers