27 lines
697 B
GDScript3
Raw Normal View History

2024-02-15 12:45:17 +00:00
extends SkillInstance
2024-02-18 17:30:52 +00:00
var direction: Vector3
2024-02-15 12:45:17 +00:00
func _ready():
2024-02-18 17:30:52 +00:00
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)
2024-02-15 12:45:17 +00:00
end()
2024-02-18 17:30:52 +00:00
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()