Mostly health

This commit is contained in:
2024-10-26 13:34:01 +02:00
parent b2105d3f62
commit 40b841e7af
12 changed files with 295 additions and 5 deletions

View File

@ -1,7 +1,20 @@
extends CharacterBody2D
signal health_depleted
var health = 100.0
const DAMAGE_RATE = 5.0
func _physics_process(delta):
var direction = Input.get_vector("move_left", "move_right", "move_up", "move_down")
velocity = direction * 200
move_and_slide()
pass
var overlappong_mobs = %Hurtbox.get_overlapping_bodies()
if overlappong_mobs.size() > 0 :
health -= DAMAGE_RATE * overlappong_mobs.size() * delta
%ProgressBar.value = health
if health <= 0.0:
health_depleted.emit()