player character has move and dodge
This commit is contained in:
21
Scripts/player_dodge_roll.gd
Normal file
21
Scripts/player_dodge_roll.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends PlayerState
|
||||
class_name PlayerDodgeRoll
|
||||
|
||||
|
||||
|
||||
const DODGE_SPEED : float = 20.0
|
||||
const DODGE_TIME : float = .1
|
||||
var dodge_timer = DODGE_TIME
|
||||
|
||||
func Enter():
|
||||
character.anim_player.play("dodge")
|
||||
|
||||
func Physics_Update(delta):
|
||||
if dodge_timer > 0:
|
||||
dodge_timer -= delta
|
||||
else:
|
||||
dodge_timer = DODGE_TIME
|
||||
Transitioned.emit(self,"on floor")
|
||||
|
||||
character.velocity.x = character.dodge_direction.x * DODGE_SPEED
|
||||
character.velocity.z = character.dodge_direction.y * DODGE_SPEED
|
||||
Reference in New Issue
Block a user