Scoring and Scoreboard implemented

This commit is contained in:
Squinty 2024-04-22 20:05:05 +00:00
parent 171193e8cd
commit 0144426aac
14 changed files with 228 additions and 22 deletions

View file

@ -16,6 +16,7 @@ class_name ExplosiveDamageComponent extends Area3D
@export var damage : int = 100
@export var impulse_force : int = 1000
var damage_dealer : Player
func _physics_process(_delta : float) -> void:
for body in get_overlapping_bodies():
@ -26,6 +27,6 @@ func _physics_process(_delta : float) -> void:
for area in get_overlapping_areas():
if area is HealthComponent and is_multiplayer_authority():
area.damage.rpc(damage)
area.damage.rpc(damage, damage_dealer.player_id)
set_physics_process(false)

View file

@ -20,17 +20,17 @@ class_name HealthComponent extends Area3D
health = value
health_changed.emit(value)
signal health_zeroed
signal health_zeroed(killer_id : int)
signal health_changed(value : float)
func _ready() -> void:
heal_full()
@rpc("call_local")
func damage(amount : float) -> void:
func damage(amount : float, damage_dealer_id : int) -> void:
health = clampf(health - amount, 0.0, max_health)
if health == 0.0:
health_zeroed.emit()
health_zeroed.emit(damage_dealer_id)
@rpc("call_local")
func _heal(amount : float) -> void: