Improved dash skill
This commit is contained in:
@ -1,6 +1,27 @@
|
||||
extends SkillInstance
|
||||
|
||||
var direction: Vector3
|
||||
|
||||
func _ready():
|
||||
animation.play("human/roll")
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
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()
|
Reference in New Issue
Block a user