Post Game jam commit

This commit is contained in:
Daniel Kauss Serna 2026-02-03 21:06:49 +01:00
commit 6db2131520
164 changed files with 172524 additions and 0 deletions

35
scripts/hitbox.gd Normal file
View file

@ -0,0 +1,35 @@
class_name Hitbox extends Area2D
var from_player = true
signal onhit;
var hitplayer = false
#func _process(delta: float) -> void:
#EventBus.cut_grass_at.emit(global_position, 14)
func _ready() -> void:
body_entered.connect(_on_body_entered)
func _on_body_entered(body: Node) -> void:
print(body)
if body is Enemy and from_player:
var bname := str(body.name)
if body.has_method("hit"):
body.hit()
onhit.emit()
body.knockback()
EventBus.debug_print.emit("Hit: " + bname)
else:
EventBus.debug_print.emit("Hitbox touched " + bname + " but it lacks 'reduce_health' method.")
if body is Player and not from_player and not hitplayer:
var bname := str(body.name)
if body.has_method("hit"):
hitplayer = true
body.hit()
onhit.emit()
EventBus.debug_print.emit("Hit: " + bname)
else:
EventBus.debug_print.emit("Hitbox touched " + bname + " but it lacks 'reduce_health' method.")
EventBus.debug_print.emit(str(body))
if body is TileMapLayer:
onhit.emit()