fix: virus

This commit is contained in:
SondreElg
2025-10-04 17:23:23 +02:00
parent 1032278c46
commit dd07f52e34
3 changed files with 5 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ extends Node2D
enum ActionState {None, Cycling, Firing, Charging}
enum MoveState {Still, Moving, Dashing, Knockback}
@export var speed = 100 # How fast the player will move (pixels/sec).
@export var speed = 200 # How fast the player will move (pixels/sec).
@export var dash_cooldown = 0.3
@export var hand_size = 3

View File

@@ -11,7 +11,7 @@ config_version=5
[application]
config/name="growth"
run/main_scene="uid://dhhnr3xkxbxlu"
run/main_scene="uid://c5qbqj52kr0aw"
config/features=PackedStringArray("4.5", "GL Compatibility")
config/icon="res://icon.svg"

View File

@@ -13,7 +13,7 @@ enum ActionState {Blocked, Waiting, Running}
var spawning_state
var action_state
var targets # who the virus will attack
var targets = [] # who the virus will attack
func _ready():
self.spawning_state = SpawningState.Spawning
@@ -22,13 +22,13 @@ func _ready():
func _process(delta):
if self.spawning_state != SpawningState.Spawned:
return # do nothing if not yet spawned
if len(self.targets) == 0:
if self.targets.size() == 0:
return # do nothing if no set targets
# --- determine nearest target
var nearest_target = self.targets[0]
var shortest_distance = 0
for i in range(1, len(self.targets)):
for i in range(1, self.targets.size()):
var target = self.targets[i]
var distance = self.position.distance_to(target)
if distance < shortest_distance: