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

Create HoverDetector behaviour

This commit is contained in:
Steffo 2024-04-14 03:43:58 +02:00
parent ac1a35c938
commit 50c783b47f
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,12 @@
extends Area2D
class_name HoverDetector
var mouse_inside = false
func _on_mouse_entered() -> void:
mouse_inside = true
func _on_mouse_exited() -> void:
mouse_inside = false

View file

@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://cbg5kgwxusvxf"]
[ext_resource type="Script" path="res://behaviours/hover_detector.gd" id="1_51m5p"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ktsow"]
radius = 8.0
[node name="HoverDetector" type="Area2D"]
script = ExtResource("1_51m5p")
[node name="Shape" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_ktsow")
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]