delete files in nickes
This commit is contained in:
@@ -2,6 +2,8 @@ extends Area2D
|
||||
|
||||
# Stairs that trigger level completion when player enters
|
||||
|
||||
@onready var sfx_stairs = null
|
||||
|
||||
func _ready():
|
||||
# Connect body entered signal
|
||||
body_entered.connect(_on_body_entered)
|
||||
@@ -9,11 +11,30 @@ func _ready():
|
||||
# Set collision layer/mask to detect players
|
||||
collision_layer = 0
|
||||
collision_mask = 1 # Detect players (layer 1)
|
||||
|
||||
# Load stairs sound effect
|
||||
if not sfx_stairs:
|
||||
# Try to create AudioStreamPlayer2D if it doesn't exist
|
||||
sfx_stairs = AudioStreamPlayer2D.new()
|
||||
sfx_stairs.name = "SfxStairs"
|
||||
add_child(sfx_stairs)
|
||||
|
||||
# Load go_down_stairs.mp3 sound
|
||||
var stairs_sound = load("res://assets/audio/sfx/walk/go_down_stairs.mp3")
|
||||
if stairs_sound:
|
||||
sfx_stairs.stream = stairs_sound
|
||||
else:
|
||||
print("Stairs: Warning - Could not load go_down_stairs.mp3")
|
||||
|
||||
func _on_body_entered(body: Node2D):
|
||||
print("Stairs: Body entered: ", body, " is_player: ", body.is_in_group("player") if body else false, " is_dead: ", body.is_dead if body and "is_dead" in body else false)
|
||||
if body and body.is_in_group("player") and not body.is_dead:
|
||||
print("Stairs: Player entered stairs! Player: ", body.name)
|
||||
|
||||
# Play stairs sound effect
|
||||
if sfx_stairs and sfx_stairs.stream:
|
||||
sfx_stairs.play()
|
||||
|
||||
# Only trigger on server/authority
|
||||
if multiplayer.is_server() or not multiplayer.has_multiplayer_peer():
|
||||
print("Stairs: Server detected, calling game_world")
|
||||
@@ -25,4 +46,3 @@ func _on_body_entered(body: Node2D):
|
||||
print("Stairs: ERROR - Game world not found!")
|
||||
else:
|
||||
print("Stairs: Not server, ignoring")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user