ft: extracted mirrorSprite to custom node

This commit is contained in:
2026-02-07 15:41:08 +01:00
parent 57c611a46d
commit 2211130fd3
8 changed files with 114 additions and 114 deletions

View File

@@ -8,6 +8,7 @@ var desired_rotation: float = self.rotation
@onready var sprite = $AnimatedSprite2D
@onready var fsm: StateMachine = $StateMachine
@onready var attack_cooldown_timer: Timer = $AttackCooldownTimer
@onready var wrapper: WrappingManager = $WrappingManager
@export var damage: int = 15
@export var attack_range = 20
@@ -71,6 +72,7 @@ func die() -> void:
func become_injured() -> void:
sprite.play("Hurt")
wrapper.play_sprite("Hurt")
func _on_sight_body_entered(body: Node2D) -> void:
if fsm.map(fsm.state) != fsm.States.HUNTING and body.is_in_group("prey") or (health < maxHealth and body.is_in_group("player")):

View File

@@ -7,7 +7,8 @@
[ext_resource type="Script" uid="uid://xbiqj7ubmj7d" path="res://molecular/prey/state_idle.gd" id="4_8a23j"]
[ext_resource type="Texture2D" uid="uid://jyuf4lgjo64" path="res://molecular/assets/predator/hammerheadRibozyme-hurt.png" id="4_shhro"]
[ext_resource type="Script" uid="uid://ubcu8fdfxxj1" path="res://molecular/prey/state_random_movement.gd" id="5_6rsu5"]
[ext_resource type="Script" path="res://molecular/predator/state_hunting.gd" id="8_7qt2q"]
[ext_resource type="Script" uid="uid://bc7apl71t0q04" path="res://molecular/predator/state_hunting.gd" id="8_7qt2q"]
[ext_resource type="Script" uid="uid://bvbc0n0pslq7p" path="res://shared/wrapping_manager.gd" id="9_shhro"]
[sub_resource type="AtlasTexture" id="AtlasTexture_8a23j"]
atlas = ExtResource("2_34kwa")
@@ -99,6 +100,11 @@ script = ExtResource("1_xp037")
maxHealth = 50
metadata/_custom_type_script = "uid://dgfimmq53whll"
[node name="WrappingManager" type="Node" parent="." unique_id=826586678 node_paths=PackedStringArray("sprite")]
script = ExtResource("9_shhro")
sprite = NodePath("../AnimatedSprite2D")
metadata/_custom_type_script = "uid://bvbc0n0pslq7p"
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=410999609]
rotation = 4.712389
sprite_frames = SubResource("SpriteFrames_shhro")