1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-22 08:04:23 +00:00

Rename HoverDetector to ScareArea in SkitterFromMouse

This commit is contained in:
Steffo 2024-04-14 03:51:23 +02:00
parent 8b8b6fbd88
commit ff0c49cf07
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 4 additions and 4 deletions

View file

@ -12,7 +12,7 @@ signal calmed
@export var directions: Array[Vector2] = [] @export var directions: Array[Vector2] = []
@onready var calm_timer: Timer = $"CalmTimer" @onready var calm_timer: Timer = $"CalmTimer"
@onready var hover_detector: HoverDetector = $"HoverDetector" @onready var scare_area: HoverDetector = $"HoverDetector"
enum State { CALM, SCARED } enum State { CALM, SCARED }
@ -44,7 +44,7 @@ func _physics_process(delta: float) -> void:
move.emit(movement) move.emit(movement)
func _on_calm_timer_timeout() -> void: func _on_calm_timer_timeout() -> void:
if hover_detector.mouse_inside: if scare_area.mouse_inside:
scare() scare()
else: else:
calm() calm()

View file

@ -6,12 +6,12 @@
[node name="SkitterFromMouse" type="Node2D"] [node name="SkitterFromMouse" type="Node2D"]
script = ExtResource("1_ftcf8") script = ExtResource("1_ftcf8")
[node name="HoverDetector" parent="." instance=ExtResource("2_cuaq0")] [node name="ScareArea" parent="." instance=ExtResource("2_cuaq0")]
[node name="CalmTimer" type="Timer" parent="."] [node name="CalmTimer" type="Timer" parent="."]
[connection signal="calmed" from="." to="." method="_on_calmed"] [connection signal="calmed" from="." to="." method="_on_calmed"]
[connection signal="move" from="." to="." method="_on_move"] [connection signal="move" from="." to="." method="_on_move"]
[connection signal="scared" from="." to="." method="_on_scared"] [connection signal="scared" from="." to="." method="_on_scared"]
[connection signal="mouse_entered" from="HoverDetector" to="." method="_on_hover_detector_mouse_entered"] [connection signal="mouse_entered" from="ScareArea" to="." method="_on_hover_detector_mouse_entered"]
[connection signal="timeout" from="CalmTimer" to="." method="_on_calm_timer_timeout"] [connection signal="timeout" from="CalmTimer" to="." method="_on_calm_timer_timeout"]