Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,18 @@ func _set_alert_other_sound_stream(new_value: AudioStream) -> void:


func _on_instant_detection_area_body_entered(body: Node2D) -> void:
# SI LO QUE ENTRÓ NO TIENE EL MÉTODO DEFEAT (NO ES EL JUGADOR), IGNÓRALO
if not body.has_method("defeat"):
return

# Si sí es el jugador, se alerta de inmediato
state = State.ALERTED
player_detected.emit(body)



func _on_detection_area_body_entered(body: Node2D) -> void:
if not body.has_method("defeat"):
return

_player = body
if _is_sight_to_point_blocked(body.global_position):
return
Expand All @@ -473,7 +480,6 @@ func _on_detection_area_body_entered(body: Node2D) -> void:
else:
state = State.DETECTING


func _on_detection_area_body_exited(body: Node2D) -> void:
_player = null
last_seen_position = body.global_position
Expand Down
4 changes: 2 additions & 2 deletions scenes/game_elements/characters/enemies/guard/guard.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ script = ExtResource("2_0hjcv")

[node name="SightRayCast" type="RayCast2D" parent="." unique_id=1964699795]
unique_name_in_owner = true
collision_mask = 8
collision_mask = 4
hit_from_inside = true
collide_with_areas = true

Expand Down Expand Up @@ -247,7 +247,7 @@ polygon = PackedVector2Array(302, 48, 283, 52, 279, 52, 101, 114, 98, 114, 79, 1

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=616054452]
unique_name_in_owner = true
position = Vector2(0, -16)
position = Vector2(-1, 1)
sprite_frames = ExtResource("5_mswbt")
animation = &"walk"
autoplay = "idle"
Expand Down
Loading