fixed the issue where enemies could walk over a gap if it wasnt on a pathfinding node

This commit is contained in:
2024-03-29 21:58:40 +11:00
parent 3c28999cd9
commit 62d0dc0130
40 changed files with 205 additions and 138 deletions

20
Scripts/sprite_bobber.gd Normal file
View File

@ -0,0 +1,20 @@
class_name SpriteBobber extends Node
@export var character: EnemyController
@export var sprite: Node3D
@export var height: float = 0.1
var default_height: float = 0.0
var sample_point: float = 0.0
func _ready() -> void:
default_height = sprite.position.y
func _process(delta: float) -> void:
sample_point += delta * (character.stats.movement_speed * 2.0)
var y_offset: float = sin(sample_point * 2.0) / 2.0 + 0.5
var x_offset: float = cos(sample_point)
sprite.position.y = default_height + (y_offset * height)
sprite.position.x = x_offset * 0.05