fix stomping

This commit is contained in:
2025-02-09 06:37:28 +01:00
parent ad973e58a2
commit 03ed7e29d1
4 changed files with 10 additions and 7 deletions

View File

@@ -5,7 +5,6 @@ extends Node
@export var area2d: Area2D
@export var root: Node2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
if not area2d:
printerr("No area2d assigned!")
@@ -31,8 +30,13 @@ func on_area2d_body_entered(body: Node2D) -> void:
if root.global_position.y < body.global_position.y:
if root is PlayerController:
var velocity: Vector2 = root.previous_velocity
print("Velocity: ", velocity)
if velocity.y > 0.0:
deal_damage(health_component)
print("Dealt damage to ", body)
var damage_component: DamageComponent = body.get_node_or_null("DamageComponent")
if not damage_component:
return
damage_component.set_process(false)
await get_tree().process_frame
damage_component.set_process(true)