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,8 +1,14 @@
extends CharacterBody2D
var health = 5
@onready var player = get_node("/root/Game/player")
func _physics_process(delta: float) -> void:
var direction = global_position.direction_to(player.global_position)
velocity = direction * 50
move_and_slide()
func take_damage():
health -= 1
if health == 0:
queue_free()