basic molotov

This commit is contained in:
Rendo 2025-12-08 20:37:19 +05:00
commit b59cb48b77
5 changed files with 133 additions and 1 deletions

View file

@ -0,0 +1,24 @@
extends Area3D
@export var dps: float
@export var damage_timer: Timer
var damage_targets: Array[Player]
func _ready() -> void:
body_entered.connect(on_body_entered)
body_exited.connect(on_body_exited)
func damage():
for target in damage_targets:
if target.is_on_floor():
target.take_damage(int(dps*damage_timer.wait_time))
func on_body_entered(body: Node3D):
if body is Player:
damage_targets.append(body)
func on_body_exited(body: Node3D):
if body is Player:
damage_targets.erase(body)