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

Make cursor indicate the possible interaction

This commit is contained in:
Steffo 2024-05-02 02:32:14 +02:00
parent cbfb6a13d6
commit 349d49a641
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
26 changed files with 190 additions and 184 deletions

View file

@ -3,8 +3,8 @@
[ext_resource type="Script" path="res://behaviours/draggable.gd" id="1_hdedq"] [ext_resource type="Script" path="res://behaviours/draggable.gd" id="1_hdedq"]
[node name="Draggable" type="Area2D"] [node name="Draggable" type="Area2D"]
collision_layer = 8 collision_layer = 0
collision_mask = 0 collision_mask = 128
input_pickable = false input_pickable = false
monitoring = false monitoring = false
script = ExtResource("1_hdedq") script = ExtResource("1_hdedq")

View file

@ -4,7 +4,7 @@
[node name="Tracker" type="Area2D"] [node name="Tracker" type="Area2D"]
collision_layer = 0 collision_layer = 0
collision_mask = 56 collision_mask = 24
input_pickable = false input_pickable = false
monitorable = false monitorable = false
script = ExtResource("1_4joji") script = ExtResource("1_4joji")

View file

@ -9,6 +9,7 @@ signal coin_inserted
@onready var blocked_tracker: Tracker = %"BlockedTracker" @onready var blocked_tracker: Tracker = %"BlockedTracker"
@onready var animator: AnimationPlayer = %"Animator" @onready var animator: AnimationPlayer = %"Animator"
@onready var game := MainGame.get_via_group(self) @onready var game := MainGame.get_via_group(self)
@onready var viewport := get_viewport()
func _on_roof_input(_viewport: Node, event: InputEvent, _shape_idx: int) -> void: func _on_roof_input(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:

View file

@ -12,6 +12,129 @@
[ext_resource type="AudioStream" uid="uid://dbj3ctst1tbuo" path="res://entities/barn_coin_drop.ogg" id="8_smljs"] [ext_resource type="AudioStream" uid="uid://dbj3ctst1tbuo" path="res://entities/barn_coin_drop.ogg" id="8_smljs"]
[ext_resource type="Texture2D" uid="uid://bfl0tkg85cvb8" path="res://entities/gold.png" id="9_4flhr"] [ext_resource type="Texture2D" uid="uid://bfl0tkg85cvb8" path="res://entities/gold.png" id="9_4flhr"]
[sub_resource type="Animation" id="Animation_ofgwt"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Coins/Coin1:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Coins/Coin1:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Coins/Coin2:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Coins/Coin2:position")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Coins/Coin3:visible")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Coins/Coin3:position")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Coins/Coin4:visible")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Coins/Coin4:position")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("Coins/Coin5:visible")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/9/type = "value"
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/path = NodePath("Coins/Coin5:position")
tracks/9/interp = 1
tracks/9/loop_wrap = true
tracks/9/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
[sub_resource type="Animation" id="Animation_p5d5r"] [sub_resource type="Animation" id="Animation_p5d5r"]
resource_name = "coin" resource_name = "coin"
length = 2.0 length = 2.0
@ -216,129 +339,6 @@ tracks/14/keys = {
} }
tracks/14/use_blend = true tracks/14/use_blend = true
[sub_resource type="Animation" id="Animation_ofgwt"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Coins/Coin1:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Coins/Coin1:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Coins/Coin2:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Coins/Coin2:position")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Coins/Coin3:visible")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Coins/Coin3:position")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Coins/Coin4:visible")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Coins/Coin4:position")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("Coins/Coin5:visible")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [false]
}
tracks/9/type = "value"
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/path = NodePath("Coins/Coin5:position")
tracks/9/interp = 1
tracks/9/loop_wrap = true
tracks/9/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_vvq7g"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_vvq7g"]
_data = { _data = {
"RESET": SubResource("Animation_ofgwt"), "RESET": SubResource("Animation_ofgwt"),
@ -361,8 +361,8 @@ size = Vector2(140, 38)
size = Vector2(73, 62) size = Vector2(73, 62)
[node name="Barn" type="StaticBody2D"] [node name="Barn" type="StaticBody2D"]
collision_layer = 88 collision_layer = 8
collision_mask = 4 collision_mask = 24
script = ExtResource("1_ny8oq") script = ExtResource("1_ny8oq")
[node name="BarnWallFront" type="Sprite2D" parent="."] [node name="BarnWallFront" type="Sprite2D" parent="."]
@ -465,7 +465,7 @@ shape = SubResource("RectangleShape2D_cpwqc")
[node name="ClickableArea" type="Area2D" parent="."] [node name="ClickableArea" type="Area2D" parent="."]
collision_layer = 128 collision_layer = 128
collision_mask = 128 collision_mask = 128
monitorable = false monitoring = false
[node name="Shape" type="CollisionShape2D" parent="ClickableArea"] [node name="Shape" type="CollisionShape2D" parent="ClickableArea"]
position = Vector2(32, -83) position = Vector2(32, -83)

View file

@ -23,7 +23,7 @@ func _on_eater_eaten(edible:Edible) -> void:
func _on_dragged(_cursor: Cursor) -> void: func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16 collision_layer = 16
collision_mask = 18 collision_mask = 16
tophatter.collision_mask = 16 tophatter.collision_mask = 16
monocler.collision_mask = 16 monocler.collision_mask = 16
z_index = Enums.ZIndex.EntityAir z_index = Enums.ZIndex.EntityAir
@ -33,7 +33,7 @@ func _on_dragged(_cursor: Cursor) -> void:
func _on_fallen() -> void: func _on_fallen() -> void:
collision_layer = 8 collision_layer = 8
collision_mask = 14 collision_mask = 8
tophatter.collision_mask = 8 tophatter.collision_mask = 8
monocler.collision_mask = 8 monocler.collision_mask = 8
z_index = Enums.ZIndex.EntityGround z_index = Enums.ZIndex.EntityGround

View file

@ -366,8 +366,8 @@ radius = 32.0
[node name="Chupacabra" type="CharacterBody2D"] [node name="Chupacabra" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 72 collision_layer = 8
collision_mask = 14 collision_mask = 8
motion_mode = 1 motion_mode = 1
script = ExtResource("1_s4qg1") script = ExtResource("1_s4qg1")
skitter_directions = Array[Vector2]([Vector2(-1, 0), Vector2(1, 0)]) skitter_directions = Array[Vector2]([Vector2(-1, 0), Vector2(1, 0)])

View file

@ -17,7 +17,7 @@ func _on_move(movement: Vector2):
func _on_dragged(_cursor: Cursor) -> void: func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16 collision_layer = 16
collision_mask = 18 collision_mask = 16
tophatter.collision_mask = 16 tophatter.collision_mask = 16
monocler.collision_mask = 16 monocler.collision_mask = 16
z_index = Enums.ZIndex.EntityAir z_index = Enums.ZIndex.EntityAir
@ -26,7 +26,7 @@ func _on_dragged(_cursor: Cursor) -> void:
func _on_fallen() -> void: func _on_fallen() -> void:
collision_layer = 8 collision_layer = 8
collision_mask = 14 collision_mask = 8
tophatter.collision_mask = 8 tophatter.collision_mask = 8
monocler.collision_mask = 8 monocler.collision_mask = 8
z_index = Enums.ZIndex.EntityGround z_index = Enums.ZIndex.EntityGround

View file

@ -195,8 +195,8 @@ radius = 50.0
[node name="Cthulhu" type="CharacterBody2D"] [node name="Cthulhu" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 72 collision_layer = 8
collision_mask = 14 collision_mask = 8
script = ExtResource("1_b55wc") script = ExtResource("1_b55wc")
[node name="SpriteFocus" type="Node2D" parent="."] [node name="SpriteFocus" type="Node2D" parent="."]

View file

@ -28,14 +28,12 @@ scale = Vector2(2, 2)
texture = ExtResource("2_tt3v6") texture = ExtResource("2_tt3v6")
[node name="MagnetizeArea" parent="." instance=ExtResource("3_ne3sj")] [node name="MagnetizeArea" parent="." instance=ExtResource("3_ne3sj")]
collision_mask = 128
[node name="Shape" type="CollisionShape2D" parent="MagnetizeArea"] [node name="Shape" type="CollisionShape2D" parent="MagnetizeArea"]
shape = SubResource("CircleShape2D_w1h35") shape = SubResource("CircleShape2D_w1h35")
debug_color = Color(0.337255, 0.611765, 1, 0) debug_color = Color(0.337255, 0.611765, 1, 0)
[node name="CollectArea" parent="." instance=ExtResource("3_ne3sj")] [node name="CollectArea" parent="." instance=ExtResource("3_ne3sj")]
collision_mask = 128
[node name="Shape" type="CollisionShape2D" parent="CollectArea"] [node name="Shape" type="CollisionShape2D" parent="CollectArea"]
shape = SubResource("CircleShape2D_jm7yp") shape = SubResource("CircleShape2D_jm7yp")

View file

@ -22,7 +22,7 @@ func _on_eater_eaten(edible: Edible) -> void:
func _on_dragged(_cursor: Cursor) -> void: func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16 collision_layer = 16
collision_mask = 18 collision_mask = 16
tophatter.collision_mask = 16 tophatter.collision_mask = 16
monocler.collision_mask = 16 monocler.collision_mask = 16
z_index = Enums.ZIndex.EntityAir z_index = Enums.ZIndex.EntityAir
@ -32,7 +32,7 @@ func _on_dragged(_cursor: Cursor) -> void:
func _on_fallen() -> void: func _on_fallen() -> void:
collision_layer = 8 collision_layer = 8
collision_mask = 14 collision_mask = 8
tophatter.collision_mask = 8 tophatter.collision_mask = 8
monocler.collision_mask = 8 monocler.collision_mask = 8
z_index = Enums.ZIndex.EntityGround z_index = Enums.ZIndex.EntityGround

View file

@ -234,8 +234,8 @@ radius = 40.0
[node name="Imp" type="CharacterBody2D"] [node name="Imp" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 72 collision_layer = 8
collision_mask = 14 collision_mask = 8
motion_mode = 1 motion_mode = 1
script = ExtResource("1_dixpc") script = ExtResource("1_dixpc")

View file

@ -10,14 +10,14 @@ func _on_move(movement: Vector2) -> void:
func _on_dragged(_cursor: Cursor) -> void: func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16 collision_layer = 16
collision_mask = 18 collision_mask = 16
z_index = Enums.ZIndex.EntityAir z_index = Enums.ZIndex.EntityAir
y_sort_enabled = false y_sort_enabled = false
animator.play(&"drag_start") animator.play(&"drag_start")
func _on_fallen() -> void: func _on_fallen() -> void:
collision_layer = 8 collision_layer = 8
collision_mask = 14 collision_mask = 8
z_index = Enums.ZIndex.EntityGround z_index = Enums.ZIndex.EntityGround
y_sort_enabled = true y_sort_enabled = true
animator.play(&"RESET") animator.play(&"RESET")

View file

@ -107,8 +107,8 @@ radius = 12.0
[node name="Monocle" type="CharacterBody2D"] [node name="Monocle" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 72 collision_layer = 8
collision_mask = 14 collision_mask = 8
motion_mode = 1 motion_mode = 1
script = ExtResource("1_ehpfj") script = ExtResource("1_ehpfj")

View file

@ -18,7 +18,7 @@ func _on_move(movement: Vector2) -> void:
func _on_dragged(_cursor: Cursor) -> void: func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16 collision_layer = 16
collision_mask = 18 collision_mask = 16
tophatter.collision_mask = 16 tophatter.collision_mask = 16
monocler.collision_mask = 16 monocler.collision_mask = 16
z_index = Enums.ZIndex.EntityAir z_index = Enums.ZIndex.EntityAir
@ -27,7 +27,7 @@ func _on_dragged(_cursor: Cursor) -> void:
func _on_fallen() -> void: func _on_fallen() -> void:
collision_layer = 8 collision_layer = 8
collision_mask = 14 collision_mask = 8
tophatter.collision_mask = 8 tophatter.collision_mask = 8
monocler.collision_mask = 8 monocler.collision_mask = 8
z_index = Enums.ZIndex.EntityGround z_index = Enums.ZIndex.EntityGround

View file

@ -211,8 +211,8 @@ radius = 8.65
[node name="Sheep" type="CharacterBody2D"] [node name="Sheep" type="CharacterBody2D"]
z_index = 1 z_index = 1
y_sort_enabled = true y_sort_enabled = true
collision_layer = 72 collision_layer = 8
collision_mask = 14 collision_mask = 8
motion_mode = 1 motion_mode = 1
script = ExtResource("1_4dmll") script = ExtResource("1_4dmll")
@ -388,6 +388,7 @@ enabled = false
alternative_priority = 50 alternative_priority = 50
[node name="Draggable" parent="MovementDrag" instance=ExtResource("14_0b1hs")] [node name="Draggable" parent="MovementDrag" instance=ExtResource("14_0b1hs")]
collision_layer = 128
[node name="Shape" type="CollisionShape2D" parent="MovementDrag/Draggable"] [node name="Shape" type="CollisionShape2D" parent="MovementDrag/Draggable"]
scale = Vector2(3, 3) scale = Vector2(3, 3)

View file

@ -10,14 +10,14 @@ func _on_move(movement: Vector2) -> void:
func _on_dragged(_cursor: Cursor) -> void: func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16 collision_layer = 16
collision_mask = 18 collision_mask = 16
z_index = Enums.ZIndex.EntityAir z_index = Enums.ZIndex.EntityAir
y_sort_enabled = false y_sort_enabled = false
animator.play(&"drag_start") animator.play(&"drag_start")
func _on_fallen() -> void: func _on_fallen() -> void:
collision_layer = 8 collision_layer = 8
collision_mask = 14 collision_mask = 8
z_index = Enums.ZIndex.EntityGround z_index = Enums.ZIndex.EntityGround
y_sort_enabled = true y_sort_enabled = true
animator.play(&"RESET") animator.play(&"RESET")

View file

@ -115,8 +115,8 @@ radius = 32.0
[node name="Skull" type="CharacterBody2D"] [node name="Skull" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 72 collision_layer = 8
collision_mask = 14 collision_mask = 8
motion_mode = 1 motion_mode = 1
script = ExtResource("1_7g8bu") script = ExtResource("1_7g8bu")

View file

@ -10,14 +10,14 @@ func _on_move(movement: Vector2) -> void:
func _on_dragged(_cursor: Cursor) -> void: func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16 collision_layer = 16
collision_mask = 18 collision_mask = 16
z_index = Enums.ZIndex.EntityAir z_index = Enums.ZIndex.EntityAir
y_sort_enabled = false y_sort_enabled = false
animator.play(&"drag_start") animator.play(&"drag_start")
func _on_fallen() -> void: func _on_fallen() -> void:
collision_layer = 8 collision_layer = 8
collision_mask = 14 collision_mask = 8
z_index = Enums.ZIndex.EntityGround z_index = Enums.ZIndex.EntityGround
y_sort_enabled = true y_sort_enabled = true
animator.play(&"RESET") animator.play(&"RESET")

View file

@ -106,8 +106,8 @@ radius = 12.0
[node name="TopHat" type="CharacterBody2D"] [node name="TopHat" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 72 collision_layer = 8
collision_mask = 14 collision_mask = 8
motion_mode = 1 motion_mode = 1
script = ExtResource("1_0eh11") script = ExtResource("1_0eh11")
@ -133,7 +133,6 @@ diet = &"TopHat"
[node name="MovementDrag" parent="." instance=ExtResource("3_gy414")] [node name="MovementDrag" parent="." instance=ExtResource("3_gy414")]
[node name="Draggable" parent="MovementDrag" instance=ExtResource("4_fcvjo")] [node name="Draggable" parent="MovementDrag" instance=ExtResource("4_fcvjo")]
collision_layer = 32
[node name="Shape" type="CollisionShape2D" parent="MovementDrag/Draggable"] [node name="Shape" type="CollisionShape2D" parent="MovementDrag/Draggable"]
shape = SubResource("CircleShape2D_juisb") shape = SubResource("CircleShape2D_juisb")

View file

@ -16,7 +16,7 @@ scale = Vector2(2, 2)
texture = ExtResource("1_yk0t0") texture = ExtResource("1_yk0t0")
[node name="Upper" type="StaticBody2D" parent="."] [node name="Upper" type="StaticBody2D" parent="."]
collision_layer = 80 collision_layer = 16
collision_mask = 0 collision_mask = 0
[node name="Shape" type="CollisionShape2D" parent="Upper"] [node name="Shape" type="CollisionShape2D" parent="Upper"]

View file

@ -241,8 +241,8 @@ radius = 40.0
[node name="Watcher" type="CharacterBody2D"] [node name="Watcher" type="CharacterBody2D"]
z_index = 10 z_index = 10
collision_layer = 80 collision_layer = 16
collision_mask = 18 collision_mask = 16
script = ExtResource("1_brahc") script = ExtResource("1_brahc")
[node name="Sprite" parent="." instance=ExtResource("1_thu73")] [node name="Sprite" parent="." instance=ExtResource("1_thu73")]
@ -430,8 +430,8 @@ bus = &"KillSounds"
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner" method="spawn"] [connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner" method="spawn"]
[connection signal="move" from="MovementTilt" to="." method="_on_move"] [connection signal="move" from="MovementTilt" to="." method="_on_move"]
[connection signal="move_enabled" from="MovementTilt" to="Animator" method="play" binds= [&"fly"]] [connection signal="move_enabled" from="MovementTilt" to="Animator" method="play" binds= [&"fly"]]
[connection signal="ready" from="MovementTilt" to="MovementTilt" method="randomize_direction"]
[connection signal="ready" from="MovementTilt" to="MovementTilt" method="randomize_rotation_speed"] [connection signal="ready" from="MovementTilt" to="MovementTilt" method="randomize_rotation_speed"]
[connection signal="ready" from="MovementTilt" to="MovementTilt" method="randomize_direction"]
[connection signal="timeout" from="MovementTilt/TimerStddev" to="MovementTilt" method="randomize_rotation_speed"] [connection signal="timeout" from="MovementTilt/TimerStddev" to="MovementTilt" method="randomize_rotation_speed"]
[connection signal="changed_target" from="MovementTrap" to="MovementTrap/TrapPriority" method="priority_conditional"] [connection signal="changed_target" from="MovementTrap" to="MovementTrap/TrapPriority" method="priority_conditional"]
[connection signal="move" from="MovementTrap" to="." method="_on_move"] [connection signal="move" from="MovementTrap" to="." method="_on_move"]

View file

@ -12,6 +12,7 @@ starting_stage = 1
[node name="SafeMarginContainer" parent="InterfaceCanvas" instance=ExtResource("2_ah6n8")] [node name="SafeMarginContainer" parent="InterfaceCanvas" instance=ExtResource("2_ah6n8")]
unique_name_in_owner = true unique_name_in_owner = true
mouse_filter = 2
min_margin_left = 16 min_margin_left = 16
min_margin_right = 16 min_margin_right = 16
min_margin_top = 16 min_margin_top = 16

View file

@ -51,12 +51,9 @@ cheat_gold={
[layer_names] [layer_names]
2d_physics/layer_1="Unset" 2d_physics/layer_1="Unset"
2d_physics/layer_2="Tiles" 2d_physics/layer_4="Ground"
2d_physics/layer_3="Trees" 2d_physics/layer_5="Air"
2d_physics/layer_4="Entities (grounded)" 2d_physics/layer_8="Draggables"
2d_physics/layer_5="Entities (air)"
2d_physics/layer_6="Pickups"
2d_physics/layer_7="System"
[physics] [physics]

View file

@ -23,15 +23,16 @@ static func get_via_group(node: Node) -> Cursor:
func find_closest_target() -> Draggable: func find_closest_target() -> Draggable:
var bodies = get_overlapping_bodies() var areas = get_overlapping_areas()
var min_distance: float = INF var min_distance: float = INF
var to_drag: Node = null var to_drag: Node = null
for body in bodies: for area in areas:
for target in body.find_children("*", "Draggable", true, false): if not area is Draggable:
var distance = position.distance_to(target.position) continue
var distance = position.distance_to(area.position)
if distance < min_distance: if distance < min_distance:
min_distance = distance min_distance = distance
to_drag = target to_drag = area
return to_drag return to_drag
func drag(): func drag():
@ -63,6 +64,14 @@ func _input(event: InputEvent) -> void:
else: else:
drop() drop()
func _process(_delta: float) -> void:
# Determine mouse cursor shape
if dragging:
Input.set_default_cursor_shape(Input.CURSOR_DRAG)
elif has_overlapping_areas():
Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND)
else:
Input.set_default_cursor_shape(Input.CURSOR_ARROW)
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:
position += (game.camera.get_global_mouse_position() - global_position) position += (game.camera.get_global_mouse_position() - global_position)

View file

@ -10,8 +10,8 @@ radius = 8.0
[node name="Cursor" type="Area2D" groups=["cursor"]] [node name="Cursor" type="Area2D" groups=["cursor"]]
z_index = 100 z_index = 100
collision_layer = 192 collision_layer = 64
collision_mask = 56 collision_mask = 128
script = ExtResource("1_1og6v") script = ExtResource("1_1og6v")
[node name="Shape" type="CollisionShape2D" parent="."] [node name="Shape" type="CollisionShape2D" parent="."]

View file

@ -882,7 +882,7 @@ unique_name_in_owner = true
[node name="BottomBoundary" type="StaticBody2D" parent="Walls"] [node name="BottomBoundary" type="StaticBody2D" parent="Walls"]
position = Vector2(0, 360) position = Vector2(0, 360)
collision_layer = 2 collision_layer = 24
collision_mask = 0 collision_mask = 0
[node name="Shape" type="CollisionShape2D" parent="Walls/BottomBoundary"] [node name="Shape" type="CollisionShape2D" parent="Walls/BottomBoundary"]
@ -891,7 +891,7 @@ shape = SubResource("WorldBoundaryShape2D_htttx")
[node name="TopBoundary" type="StaticBody2D" parent="Walls"] [node name="TopBoundary" type="StaticBody2D" parent="Walls"]
position = Vector2(0, -360) position = Vector2(0, -360)
rotation = 3.14159 rotation = 3.14159
collision_layer = 2 collision_layer = 24
collision_mask = 0 collision_mask = 0
[node name="Shape" type="CollisionShape2D" parent="Walls/TopBoundary"] [node name="Shape" type="CollisionShape2D" parent="Walls/TopBoundary"]
@ -900,7 +900,7 @@ shape = SubResource("WorldBoundaryShape2D_htttx")
[node name="RightBoundary" type="StaticBody2D" parent="Walls"] [node name="RightBoundary" type="StaticBody2D" parent="Walls"]
position = Vector2(640, 0) position = Vector2(640, 0)
rotation = 4.71239 rotation = 4.71239
collision_layer = 2 collision_layer = 24
collision_mask = 0 collision_mask = 0
[node name="Shape" type="CollisionShape2D" parent="Walls/RightBoundary"] [node name="Shape" type="CollisionShape2D" parent="Walls/RightBoundary"]
@ -909,7 +909,7 @@ shape = SubResource("WorldBoundaryShape2D_htttx")
[node name="LeftBoundary" type="StaticBody2D" parent="Walls"] [node name="LeftBoundary" type="StaticBody2D" parent="Walls"]
position = Vector2(-640, 0) position = Vector2(-640, 0)
rotation = 1.5708 rotation = 1.5708
collision_layer = 2 collision_layer = 24
collision_mask = 0 collision_mask = 0
[node name="Shape" type="CollisionShape2D" parent="Walls/LeftBoundary"] [node name="Shape" type="CollisionShape2D" parent="Walls/LeftBoundary"]