Skip to content

Score counter

This content is not available in your language yet.

This one is going to be quick, because it’s simple.

  1. In your singleton, add a score variable and start it at 0.

  2. Add the built-in _exit_tree function to your enemy, and in it add one to the singleton’s score variable.

  3. 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.

  4. Give the Label a quick built-in script:

    extends Label
    func _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.

Contribute Donate