Skip to content

Commit 0b22abd

Browse files
committed
Do not hardcode head path
1 parent 184bd4e commit 0b22abd

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

scenes/game_elements/characters/components/character_randomizer.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ var _random_number_generator := RandomNumberGenerator.new()
4646

4747
var _previous_look_at_side: Enums.LookAtSide = Enums.LookAtSide.UNSPECIFIED
4848

49+
## The character head node. This can be used to show the head only in the HUD.
50+
@onready var head: AnimatedSprite2D = %AnimatedSprite2DHead
51+
4952

5053
## Randomize the skin color and textures of the character.
5154
## [br][br]

scenes/game_elements/characters/npcs/townie.tscn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ sprite = NodePath("..")
8484
metadata/_custom_type_script = "uid://dy68p7gf07pi3"
8585

8686
[node name="AnimatedSprite2DHead" type="AnimatedSprite2D" parent="AnimatedSprite2DLegs/AnimatedSprite2DBody" unique_id=421503015]
87+
unique_name_in_owner = true
8788
material = ExtResource("1_nj51j")
8889
instance_shader_parameters/shade_high_new = Color(0.91999996, 0.91999996, 0.2, 1)
8990
instance_shader_parameters/shade_low_new = Color(0.71999997, 0.71999997, 0, 1)

scenes/ui_elements/story_quest_progress/components/story_quest_progress.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func _on_upgrade_changed() -> void:
4545
add_child(helper_character)
4646
helper_character.character_seed = GameState.upgrade_character_seed
4747
helper_character.apply_character_randomizations()
48-
var head := helper_character.get_child(1).get_child(1).get_child(2)
48+
var head := helper_character.head
4949
head.global_position = helper_marker.global_position
5050
head.reparent(helper_container)
5151
head.process_mode = Node.PROCESS_MODE_DISABLED

0 commit comments

Comments
 (0)