Score counter
This content is not available in your language yet.
This one is going to be quick, because it’s simple.
-
In your singleton, add a
score
variable and start it at 0. -
Add the built-in
_exit_tree
function to your enemy, and in it add one to the singleton’s score variable. -
As a child of your camera in your player scene, add a CanvasLayer node with a Label child. Anchor the Label to the top of the screen.
-
Give the Label a quick built-in script:
extends Labelfunc _process(_delta):text = "Score: " + str(Singleton.score)This is awfully inefficient since it really doesn’t need to check every frame. But, it’ll work for now.