AIs now wont go on top of their target.

This commit is contained in:
Relintai 2020-02-21 14:09:43 +01:00
parent 79f5ffd084
commit 8ac869ac1f

View File

@ -29,6 +29,9 @@ var _data : Dictionary = {
"spells": [] "spells": []
} }
func _ready():
pass
func _on_set_owner(): func _on_set_owner():
if not is_instance_valid(owner): if not is_instance_valid(owner):
return return
@ -112,14 +115,17 @@ func attack(delta):
cast = true cast = true
break break
if owner.sis_casting(): if owner.sis_casting():
owner.target_movement_direction = Vector2() owner.target_movement_direction = Vector2()
return return
var dir : Vector3 = target.get_body().translation - owner.get_body().translation owner.target_movement_direction = Vector2()
owner.target_movement_direction = Vector2(dir.x, dir.z) var dir : Vector3 = target.get_body().translation - owner.get_body().translation
var l = dir.length()
if l > 2.5:
owner.target_movement_direction = Vector2(dir.x, dir.z)
func sort_spells_by_rank(a, b): func sort_spells_by_rank(a, b):
if a == null or b == null: if a == null or b == null: