GodotGameWorkshop/Scripts/stair.gd
2025-12-15 19:10:59 -05:00

26 lines
867 B
GDScript

extends Node2D
@export var z_index_above := 6 # player draws above stairs while climbing
@export var z_index_below := 2 # player draws behind stairs when not climbing
func get_above_z_index(): return z_index_above
func get_below_z_index(): return z_index_below
func _ready():
z_index = 3
func _on_mount_trigger_body_exited(body):
print("[MountTrigger] body_exited:", body.name)
if body.has_method("on_stairs_trigger_exit"):
body.on_stairs_trigger_exit(self)
func _on_mount_trigger_body_entered(body):
print("[MountTrigger] body_entered:", body.name)
if body.has_method("on_stairs_trigger_enter"):
body.on_stairs_trigger_enter(self, z_index_above, z_index_below)
func _on_top_exit_body_entered(body: Node2D) -> void:
print("[Stairs] TopExit entered by:", body.name)
if body.has_method("on_stairs_top_reached"):
body.on_stairs_top_reached(self)