27 lines
697 B
GDScript

extends SkillInstance
var direction: Vector3
func _ready():
direction = movement.direction
if direction == Vector3.ZERO:
direction = (get_parent() as CharacterBody3D).global_basis.z
movement.set_physics_process(false)
set_physics_process(true)
animation.play("human/dash")
await get_tree().create_timer(0.3).timeout
movement.set_physics_process(true)
set_physics_process(false)
end()
func _physics_process(_delta):
if movement.direction:
direction = movement.direction
var body := get_parent() as CharacterBody3D
body.velocity.x = direction.x * movement.move_speed * 3.0
body.velocity.y = 0
body.velocity.z = direction.z * movement.move_speed * 3.0
body.move_and_slide()