Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name: Password:
Ambiera Forum > CopperCube > Help with CopperCube
Score in CopperCube
Author Text

dynamogames
Registered User
Quote
2022-07-09 00:31:06

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.


okeoke
Registered User
Quote
2022-07-09 09:28:03

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.


dynamogames
Registered User
Quote
2022-07-09 13:40:38

Thanks @okeoke, I've been able to create it. I'm so grateful for your help.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© 2020 Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact