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

21
scripts/bullet.gd Normal file
View File

@ -0,0 +1,21 @@
extends Area2D
const SPEED = 500
const RANGE = 500
var travelled_distance = 0
func _physics_process(delta: float) -> void:
var direction = Vector2.RIGHT.rotated(rotation)
position += direction * SPEED * delta
travelled_distance += SPEED * delta
if travelled_distance > RANGE:
queue_free()
func _on_body_entered(body: Node2D) -> void:
queue_free()
if body.has_method("take_damage"):
body.take_damage()