How to set up scoring

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By D_Dazzle

So I’m making a endless space shooter game, and I’m trying to set up scoring but nothing is working. I’ve tried using labels and areas. The way my code is set up is for the enemies they die when my bullet hits them, but I don’t have hp set up. Is it just that I am a noob and don’t know how to use labels?
My bullet code:
extends KinematicBody

var velo = Vector3()
var KillParticles = load(“res://KillParticles.tscn”)
onready var main = get_tree().current_scene
onready var explodeSound = $EnemyExplode
var score = 0

func _physics_process(delta):

func _on_Area_body_entered(body):
if body.is_in_group(“Enemies”):
var particles = KillParticles.instance()
particles.transform.origin = transform.origin
score += 10
visible = false
$Area/CollisionShape.disabled = true

func _on_LightTimer_timeout():
$OmniLight.visible = false

Well for one its odd to have the score inside the bullet scene since it will most likely be freed at some point

Wakatta | 2021-11-21 00:53

:bust_in_silhouette: Reply From: Inces

So your every bullet has its own score. Is it how You imagined it ? :slight_smile:
Most practical way is to emit some signal on death collision, and have this signal connected to some score menager to count those emissions. If You didn’t hear about signals, get to reading documentation :wink: