Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I am trying to create a system where my game has a score counter where it increases when the player kills different types of enemies. For example, enemy 1 increases player score by 10 and enemy 6 increases player score by 50 and I also want the player to be able to save their score, and the player can also know his/ her high score which displays beside the normal score. I'll be glad if anyone can help me solve this. |
||||
|
Hi 1. Add "before first drawning..." behavior to the root scene, make sure you have "Also on reload" checked; 2. Add two actions -> set variable "currentScore" to 0 and read variable from disk "hiScore" 3. On your enemy 1 node add/choose "Actor with health" behavior, on ActionsOnDeath field add action which increases the "currentScore" variable by 10; 4. Do the same for other enemy types setting the increment value respectively to the enemy type; 5. Add 2d text orverlay and name it somehow. Remember to check "Show text" checkbox; 6. Add "Every few seconds do something" behavior to the root node. Set the interval to 100 ms or something similar; 7. Add action "If varialble has value", set variable name to "currentScore", set If field to "is bigger than", type to "Variable", value to "hiScore". On action set the hiScore variable to value of currentScore. Basically, the idea is to change hiScore variable value to currentScore value in case it's bigger. 8. Add "change 2d overlay text" action to "Every few second..." from p7. Set node to just created 2d overlay and text to something like: "Score: $currentScore$ HiScore: $hiScore$" 9. Very last thing you need to save the hiScore variable to disk as the game is over using corresponding action. |
||||
|
Thanks @okeoke, I've been able to create it. I'm so grateful for your help. |
|