This commit is contained in:
MarcEricMartel 2023-10-10 19:33:00 -04:00
parent be7dc157d5
commit bf1ed7ebbf
2 changed files with 3 additions and 2 deletions

View File

@ -17,7 +17,6 @@ position = Vector2(497, 324)
position = Vector2(248, 225)
motion_mode = 0
[node name="BatSpawnable2" parent="." instance=ExtResource("3_a1ucf")]
position = Vector2(644, 251)
motion_mode = 0

View File

@ -97,11 +97,13 @@ func processAI(objs):
var vec: Vector2 = Vector2(0,0)
var weight: int = 0
for obj in objs:
if !obj || !obj.isAlive:
continue
if position.distance_to(obj.position) > 10:
weight = abs(obj.priority) * position.distance_to(obj.position)
vec += weight * position.direction_to(obj.position)
else:
weight = obj.priority * position.distance_to(obj.position) * (maxhp / hp) * 100
weight = obj.priority * position.distance_to(obj.position) * ((maxhp + 1) / hp)
vec += weight * -position.direction_to(obj.position)
if vec.length() < 5 && objs.size() > 1: