start of tossing system

This commit is contained in:
Haze Weathers 2024-09-22 14:17:54 -04:00
parent f5999da412
commit dc2a1a78f3
12 changed files with 193 additions and 38 deletions

View file

@ -22,6 +22,7 @@ var input_dir: float = 0.0
var aim_back_arm: bool = false
var _was_on_floor: bool = true
var _highlighted_pickup: Pickup = null
func _ready() -> void:
@ -117,3 +118,17 @@ func _airborn_physics_process(delta: float) -> void:
velocity += get_gravity() * delta
#endregion
#endregion
#region Collision Signals
func _on_pickup_area_entered(area: Area2D) -> void:
if not _highlighted_pickup:
_highlighted_pickup = area.get_parent() as Pickup
_highlighted_pickup.highlight = true
func _on_pickup_area_exited(area: Area2D) -> void:
if _highlighted_pickup == (area.get_parent() as Pickup):
_highlighted_pickup.highlight = false
_highlighted_pickup = null
#endregion

View file

@ -23,8 +23,8 @@
[ext_resource type="Texture2D" uid="uid://d1qyuom3pxifj" path="res://textures/player/foot_front.png" id="12_dda5a"]
[ext_resource type="Texture2D" uid="uid://cssnogcrn57xv" path="res://textures/player/skirt.png" id="13_qgkik"]
[sub_resource type="Animation" id="Animation_6roai"]
resource_name = "stand"
[sub_resource type="Animation" id="Animation_7ampj"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
@ -206,8 +206,8 @@ tracks/14/keys = {
"values": [Vector2(1, 6)]
}
[sub_resource type="Animation" id="Animation_7ampj"]
length = 0.001
[sub_resource type="Animation" id="Animation_6roai"]
resource_name = "stand"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
@ -637,6 +637,14 @@ position = Vector2(-0.5, -16)
shape = SubResource("RectangleShape2D_wydm2")
debug_color = Color(0.720957, 0.248475, 1, 0.42)
[node name="PickupDetector" type="Area2D" parent="."]
unique_name_in_owner = true
collision_layer = 0
collision_mask = 128
monitorable = false
[node name="Camera2D" type="Camera2D" parent="."]
[node name="Graphics" type="Node2D" parent="."]
unique_name_in_owner = true
@ -872,8 +880,8 @@ delay_in_seconds = "0.0"
editor_description = "Performs no movement."
script = ExtResource("5_8e8ei")
[node name="Camera2D" type="Camera2D" parent="."]
[connection signal="area_entered" from="PickupDetector" to="." method="_on_pickup_area_entered"]
[connection signal="area_exited" from="PickupDetector" to="." method="_on_pickup_area_exited"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Active" to="." method="_active_physics_process"]
[connection signal="child_state_entered" from="StateChart/Root/Movement/Active/Grounded" to="." method="_grounded_child_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Active/Grounded/Standing" to="." method="_standing_entered"]