fixed the issue where enemies could walk over a gap if it wasnt on a pathfinding node
This commit is contained in:
20
Scripts/sprite_bobber.gd
Normal file
20
Scripts/sprite_bobber.gd
Normal 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
|
Reference in New Issue
Block a user