Changing bridge layer logic to Bridge script instead of BasicCharacter. The Bridge was moved from GameLevel to TerrainManager because its more related to terrain.

This commit is contained in:
2025-06-21 20:34:26 -03:00
parent 57b67e6d98
commit 724df1b070
10 changed files with 127 additions and 39 deletions

View File

@@ -0,0 +1,23 @@
extends Area2D
class_name BellowBridgeArea
var is_character_bellow_bridge: bool = false
var character_body: Node2D = null
func _on_body_entered(_body: Node2D) -> void:
self._set_character_body_bellow_bridge(_body, true)
func _on_body_exited(_body: Node2D) -> void:
self._set_character_body_bellow_bridge(_body, false)
func _set_character_body_bellow_bridge(_body: Node2D, _state: bool) -> void:
if _body is BaseCharacter:
self.is_character_bellow_bridge = _state
self.character_body = _body
print("bellow bridge: " + str(_state))
func get_character_body_bellow_bridge() -> bool:
return self.is_character_bellow_bridge
func get_body() -> Node2D:
return self.character_body