mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-25 09:34:24 +00:00
Create HoverDetector
behaviour
This commit is contained in:
parent
ac1a35c938
commit
50c783b47f
2 changed files with 27 additions and 0 deletions
12
behaviours/hover_detector.gd
Normal file
12
behaviours/hover_detector.gd
Normal 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
|
15
behaviours/hover_detector.tscn
Normal file
15
behaviours/hover_detector.tscn
Normal 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"]
|
Loading…
Reference in a new issue