File tree Expand file tree Collapse file tree
scenes/game_elements/characters/npcs/elder Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,12 +33,26 @@ var _storybook: Storybook
3333@onready var talk_behavior : TalkBehavior = % TalkBehavior
3434@onready var _book_sound : AudioStreamPlayer2D = % BookSound
3535@onready var _storybook_layer : CanvasLayer = % StorybookLayer
36+ @onready var _shapes : Array [CollisionShape2D ] = [$ BodyShape , $ StaffShape ]
3637
3738
3839func _ready () -> void :
3940 super ._ready ()
41+
42+ # Verify if the sprite_frames resource exists and matches the mirrored asset
43+ var is_mirrored := sprite_frames and sprite_frames .resource_path .ends_with ("elder2.tres" )
44+
45+ for shape in _shapes :
46+ if shape :
47+ # Mirror or reset X position depending on the resource path
48+ if is_mirrored :
49+ shape .position .x = - abs (shape .position .x )
50+ else :
51+ shape .position .x = abs (shape .position .x )
52+
4053 if Engine .is_editor_hint ():
4154 return
55+
4256 talk_behavior .dialogue = dialogue
4357 talk_behavior .before_dialogue = _before_dialogue
4458 interact_area .interaction_ended .connect (_on_interaction_ended )
Original file line number Diff line number Diff line change 1- [gd_scene load_steps =9 format =3 uid ="uid://bytkm0r5fe5xb" ]
1+ [gd_scene load_steps =10 format =3 uid ="uid://bytkm0r5fe5xb" ]
22
33[ext_resource type ="Script" uid ="uid://dedhjloxblho6" path ="res://scenes/game_elements/characters/npcs/elder/components/elder.gd" id ="1_jlpjw" ]
44[ext_resource type ="Resource" uid ="uid://ykdgo73x62wa" path ="res://scenes/game_elements/characters/npcs/elder/components/story_quest_starter.dialogue" id ="2_kqtes" ]
1111radius = 12.0
1212height = 74.0
1313
14+ [sub_resource type ="CapsuleShape2D" id ="CapsuleShape2D_ak236" ]
15+ radius = 8.0
16+ height = 24.0
17+
1418[sub_resource type ="RectangleShape2D" id ="RectangleShape2D_3eksq" ]
1519size = Vector2 (67 , 72 )
1620
@@ -27,13 +31,17 @@ position = Vector2(0, -40)
2731sprite_frames = ExtResource ("3_ak236" )
2832animation = &"idle"
2933autoplay = "idle"
30- frame_progress = 0.757037
3134
32- [node name ="CollisionShape2D " type ="CollisionShape2D" parent ="." ]
33- position = Vector2 (8 , 0 )
35+ [node name ="BodyShape " type ="CollisionShape2D" parent ="." ]
36+ position = Vector2 (1 , 0 )
3437rotation = -1.5708
3538shape = SubResource ("CapsuleShape2D_3vyb7" )
3639
40+ [node name ="StaffShape" type ="CollisionShape2D" parent ="." ]
41+ position = Vector2 (49 , 15 )
42+ rotation = 1.5708
43+ shape = SubResource ("CapsuleShape2D_ak236" )
44+
3745[node name ="InteractArea" type ="Area2D" parent ="." ]
3846unique_name_in_owner = true
3947collision_layer = 32
You can’t perform that action at this time.
0 commit comments