Adds enemies

This commit is contained in:
Michel 2025-02-01 22:51:01 +01:00
parent cf8ba8bacb
commit 76e5b1927f
324 changed files with 28447 additions and 106 deletions

View file

@ -0,0 +1,35 @@
#*
#* is_aligned_with_target.gd
#* =============================================================================
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
#*
#* Use of this source code is governed by an MIT-style
#* license that can be found in the LICENSE file or at
#* https://opensource.org/licenses/MIT.
#* =============================================================================
#*
@tool
extends BTCondition
## Checks if the agent is horizontally aligned with the target. [br]
## Returns [code]SUCCESS[/code] if the agent is horizontally aligned with the target.
## Returns [code]FAILURE[/code] if not aligned or if target is not a valid node instance.
@export var target_var: StringName = &"target"
@export var tolerance: float = 30.0
# Display a customized name (requires @tool).
func _generate_name() -> String:
return "IsAlignedWithTarget " + LimboUtility.decorate_var(target_var)
# Called each time this task is ticked (aka executed).
func _tick(_delta: float) -> Status:
var target := blackboard.get_var(target_var) as Node2D
if not is_instance_valid(target):
return FAILURE
var y_diff: float = absf(target.global_position.y - agent.global_position.y)
if y_diff < tolerance:
return SUCCESS
return FAILURE