Improved dash skill
This commit is contained in:
@ -4,11 +4,13 @@ extends Node
|
||||
var state: StateComponent
|
||||
var animation: AnimationComponent
|
||||
var voice: VoiceComponent
|
||||
var movement: MovementComponent
|
||||
|
||||
func _enter_tree():
|
||||
state = get_parent().get_node("State") as StateComponent
|
||||
animation = get_parent().get_node("Animation") as AnimationComponent
|
||||
voice = get_parent().get_node("Voice") as VoiceComponent
|
||||
movement = get_parent().get_node("Movement") as MovementComponent
|
||||
state.current = StateComponent.State.Skill
|
||||
|
||||
func end():
|
||||
|
@ -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