Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[gd_scene format=3 uid="uid://b3111eergq5yg"]

[ext_resource type="Script" uid="uid://b7704hdflt5t8" path="res://scenes/game_elements/characters/player/components/player_hook.gd" id="1_40sye"]
[ext_resource type="PackedScene" uid="uid://b0dehcnfo68j1" path="res://scenes/game_elements/props/hook_control/hook_control.tscn" id="2_5svv0"]

[node name="PlayerHook" type="Node2D" unique_id=1972626703 node_paths=PackedStringArray("character") groups=["hook_listener"]]
script = ExtResource("1_40sye")
character = NodePath("")

[node name="HookControl" parent="." unique_id=1022482491 instance=ExtResource("2_5svv0")]
state = 1

[node name="HookEnding" type="Marker2D" parent="." unique_id=123633963]
11 changes: 2 additions & 9 deletions scenes/game_elements/characters/player/player.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
[ext_resource type="PackedScene" uid="uid://yfpfno276rol" path="res://scenes/game_elements/props/fixed_size_label/fixed_size_label.tscn" id="6_h17s1"]
[ext_resource type="Script" uid="uid://e78f8iq448e1" path="res://scenes/game_elements/characters/player/components/animation_player.gd" id="7_0owmy"]
[ext_resource type="AudioStream" uid="uid://cx6jv2cflrmqu" path="res://assets/third_party/sounds/characters/player/Foot.ogg" id="11_blfj0"]
[ext_resource type="Script" uid="uid://b7704hdflt5t8" path="res://scenes/game_elements/characters/player/components/player_hook.gd" id="11_nrnyj"]
[ext_resource type="Texture2D" uid="uid://dxaq5piwxqnht" path="res://scenes/game_elements/characters/player/components/dust.png" id="12_3in67"]
[ext_resource type="PackedScene" uid="uid://cl06pid826dtg" path="res://scenes/game_elements/characters/player/components/player_repel.tscn" id="12_tnibl"]
[ext_resource type="PackedScene" uid="uid://b0dehcnfo68j1" path="res://scenes/game_elements/props/hook_control/hook_control.tscn" id="13_ecbbk"]
[ext_resource type="PackedScene" uid="uid://b3111eergq5yg" path="res://scenes/game_elements/characters/player/components/player_hook.tscn" id="13_ecbbk"]
[ext_resource type="Script" uid="uid://bk52qjv58locq" path="res://scenes/game_logic/light2d_behaviors/artificial_light_behavior.gd" id="16_ecbbk"]
[ext_resource type="Texture2D" uid="uid://b5ooaiyxdrp6a" path="res://scenes/game_elements/components/light_texture_256x256.tres" id="16_tnibl"]

Expand Down Expand Up @@ -441,17 +440,11 @@ grow_vertical = 2
unique_name_in_owner = true
position = Vector2(0, -24)

[node name="PlayerHook" type="Node2D" parent="." unique_id=1215042910 node_paths=PackedStringArray("character") groups=["hook_listener"]]
[node name="PlayerHook" parent="." unique_id=1972626703 node_paths=PackedStringArray("character") instance=ExtResource("13_ecbbk")]
unique_name_in_owner = true
position = Vector2(0, -20)
script = ExtResource("11_nrnyj")
character = NodePath("..")

[node name="HookControl" parent="PlayerHook" unique_id=1395550080 instance=ExtResource("13_ecbbk")]
state = 1

[node name="HookEnding" type="Marker2D" parent="PlayerHook" unique_id=94764927]

[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=683750023]
unique_name_in_owner = true
libraries/ = SubResource("AnimationLibrary_qek5x")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ extends Area2D
## depending on the value of [member weight] and the controlled entity being a
## [CharacterBody2D].
## [br][br]
## [b]Note:[/b] This area is expected to be in the "hookable" collision layer.
## This script automatically configures the correct [member collision_layer] and
## [member collision_mask] values to enable interaction with the grappling hook.

## The game entity that becomes hookable.
## [br][br]
Expand Down Expand Up @@ -58,6 +59,12 @@ func _enter_tree() -> void:
controlled_entity = get_parent()


func _ready() -> void:
collision_layer = 0
collision_mask = 0
set_collision_layer_value(Enums.CollisionLayers.HOOKABLE, true)


## Return the global position used to connect the hook.
func get_anchor_position() -> Vector2:
return anchor_point.global_position if anchor_point else global_position
Expand All @@ -67,13 +74,6 @@ func _get_configuration_warnings() -> PackedStringArray:
var warnings: PackedStringArray
if not controlled_entity:
warnings.append("Controlled Entity must be set.")
if not get_collision_layer_value(Enums.CollisionLayers.HOOKABLE):
warnings.append(
(
"Consider enabling collision with the hookable layer: %d."
% Enums.CollisionLayers.HOOKABLE
)
)
return warnings


Expand Down
9 changes: 0 additions & 9 deletions scenes/game_elements/props/hookable_area/hookable_area.tscn

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene format=3 uid="uid://dohb701lxbe5s"]

[ext_resource type="Texture2D" uid="uid://cdsv6qj0s3enp" path="res://scenes/game_elements/props/hookable_needle/components/needle.png" id="1_51v7k"]
[ext_resource type="PackedScene" uid="uid://ekgkd6j30py8" path="res://scenes/game_elements/props/hookable_area/hookable_area.tscn" id="3_q65sc"]
[ext_resource type="Script" uid="uid://dabvr3pqmyya4" path="res://scenes/game_elements/props/hookable_area/components/hookable_area.gd" id="2_1ash0"]
[ext_resource type="PackedScene" uid="uid://b0dehcnfo68j1" path="res://scenes/game_elements/props/hook_control/hook_control.tscn" id="3_te154"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_bfd1i"]
Expand All @@ -17,10 +17,14 @@ collision_mask = 0
position = Vector2(0, -32)
texture = ExtResource("1_51v7k")

[node name="HookableArea" parent="." unique_id=2142381948 node_paths=PackedStringArray("controlled_entity", "hook_control", "anchor_point") instance=ExtResource("3_q65sc")]
[node name="HookableArea" type="Area2D" parent="." unique_id=1826386316 node_paths=PackedStringArray("controlled_entity", "hook_control", "anchor_point")]
collision_layer = 4096
collision_mask = 0
script = ExtResource("2_1ash0")
controlled_entity = NodePath("..")
hook_control = NodePath("HookControl")
anchor_point = NodePath("Marker2D")
metadata/_custom_type_script = "uid://dabvr3pqmyya4"

[node name="CollisionShape2D" type="CollisionShape2D" parent="HookableArea" unique_id=1279070361]
position = Vector2(0, -28)
Expand Down
Loading
Loading