fx: sprite playing behaviour

This commit is contained in:
2026-03-01 15:43:06 +01:00
parent 9dd1d45698
commit 241dfb3073
7 changed files with 8 additions and 6 deletions

View File

@@ -78,7 +78,6 @@ func get_new_flow():
func calc_distance(one, two) -> float: func calc_distance(one, two) -> float:
var candidate = one.distance_to(two) var candidate = one.distance_to(two)
var onedup = one var onedup = one
# FIXME: doesnt work-- predators lose track across game boundary
if one.x < screen_size.x/2: if one.x < screen_size.x/2:
if one.y < screen_size.y/2: if one.y < screen_size.y/2:
# top left # top left
@@ -103,7 +102,7 @@ func calc_distance(one, two) -> float:
onedup.x += screen_size.x onedup.x += screen_size.x
candidate = min(candidate, onedup.distance_to(two)) candidate = min(candidate, onedup.distance_to(two))
else: else:
# botom right # bottom right
onedup.y += screen_size.y onedup.y += screen_size.y
candidate = min(candidate, onedup.distance_to(two)) candidate = min(candidate, onedup.distance_to(two))
onedup.y -= screen_size.y onedup.y -= screen_size.y

View File

@@ -113,7 +113,7 @@ script = ExtResource("4_mys4o")
[node name="PreyManager" type="Node" parent="." unique_id=1486332229] [node name="PreyManager" type="Node" parent="." unique_id=1486332229]
script = ExtResource("5_cthuy") script = ExtResource("5_cthuy")
scene = ExtResource("6_a5cls") scene = ExtResource("6_a5cls")
minCount = 100 minCount = 10
maxCount = 30 maxCount = 30
metadata/_custom_type_script = "uid://coetidfssb80w" metadata/_custom_type_script = "uid://coetidfssb80w"

View File

@@ -8,7 +8,7 @@ var can_attack: bool = true
@onready var attack_cooldown_timer: Timer = $AttackCooldownTimer @onready var attack_cooldown_timer: Timer = $AttackCooldownTimer
@onready var wrapper: WrappingManager = $WrappingManager @onready var wrapper: WrappingManager = $WrappingManager
@onready var collision: CharacterBody2D = $Collision @onready var collision: CharacterBody2D = $Collision
@onready var sprite = $"Collision/Sprite" @onready var sprite = $Collision/Sprite
@export var damage: int = 15 @export var damage: int = 15
@export var attack_range = 40 @export var attack_range = 40
@export var sight_range = 200 @export var sight_range = 200
@@ -16,6 +16,7 @@ var can_attack: bool = true
func _ready() -> void: func _ready() -> void:
health = maxHealth health = maxHealth
sprite.play("Healthy") sprite.play("Healthy")
wrapper.play_sprite("Healthy")
if starting_pos: if starting_pos:
collision.set_position(starting_pos) collision.set_position(starting_pos)

View File

@@ -124,7 +124,7 @@ light_mask = 4
visibility_layer = 4 visibility_layer = 4
position = Vector2(-1.0900421, 1.6350927) position = Vector2(-1.0900421, 1.6350927)
rotation = -1.5707964 rotation = -1.5707964
polygon = PackedVector2Array(-27.769547, -29.426758, 31.88504, -29.184647, 12.700996, 28.7294, 56.058624, 148.93633, 22.979004, 163.77974, -19.854843, 161.65926, -53.782654, 143.84715, -8.333115, 30.157196) polygon = PackedVector2Array(14.135091, 27.34004, 56.058624, 148.93633, 22.979004, 163.77974, -19.854843, 161.65926, -53.782654, 143.84715, -5.8649073, 27.34004)
[node name="WrappingManager" type="Node" parent="." unique_id=826586678] [node name="WrappingManager" type="Node" parent="." unique_id=826586678]
script = ExtResource("9_shhro") script = ExtResource("9_shhro")

View File

@@ -6,6 +6,7 @@ func enter(previous_state_path: String, data := {}) -> void:
if data.has("target"): if data.has("target"):
target = data["target"] target = data["target"]
owner.sprite.play("Hunting") owner.sprite.play("Hunting")
owner.wrapper.play_sprite("Hunting")
else: else:
# default behaviour; do nothing # default behaviour; do nothing
finished.emit(owner.fsm.States.IDLE, {}) finished.emit(owner.fsm.States.IDLE, {})

View File

@@ -10,6 +10,7 @@ var starting_pos
func _ready() -> void: func _ready() -> void:
health = maxHealth health = maxHealth
sprite.play("Healthy") sprite.play("Healthy")
wrapper.play_sprite("Healthy")
if starting_pos: if starting_pos:
collision.set_position(starting_pos) collision.set_position(starting_pos)

View File

@@ -84,7 +84,7 @@ light_mask = 2
visibility_layer = 2 visibility_layer = 2
rotation = 1.5707964 rotation = 1.5707964
scale = Vector2(10, 10) scale = Vector2(10, 10)
polygon = PackedVector2Array(3.8686981, -6.2705374, 7.0000973, -0.08602524, 3.5555592, 5.6287766, -3.0986624, 5.589636, -6.1517763, 0.031402588, -2.942093, -6.0748243, -29.993027, -74.37026, -11.10141, -83.6233, 9.332382, -84.00884, 35.163773, -77.06906) polygon = PackedVector2Array(3.8686981, -6.2705374, -2.942093, -6.0748243, -29.993027, -74.37026, -11.10141, -83.6233, 9.332382, -84.00884, 35.163773, -77.06906)
[node name="WrappingManager" type="Node" parent="." index="1" unique_id=407460873] [node name="WrappingManager" type="Node" parent="." index="1" unique_id=407460873]
script = ExtResource("3_lecx4") script = ExtResource("3_lecx4")