30 lines
698 B
GDScript
30 lines
698 B
GDScript
extends State
|
|
class_name PlayerRoll
|
|
|
|
var crouching_cshape = preload("res://resources/player crouching cshape.tres")
|
|
var standing_cshape = preload("res://resources/player standing cshape.tres")
|
|
|
|
func get_state_name():
|
|
return str(self).split(":")[0]
|
|
|
|
func enter():
|
|
player.ap.play("roll")
|
|
player.direction_locked = true
|
|
|
|
player.cshape.shape = crouching_cshape
|
|
player.cshape.position.y = -31
|
|
player.v_mult = player.roll_mult
|
|
|
|
func exit():
|
|
player.cshape.shape = standing_cshape
|
|
player.cshape.position.y = -44
|
|
player.v_mult = 1
|
|
player.direction_locked = false
|
|
|
|
func update(delta):
|
|
pass
|
|
|
|
func physics_update(delta):
|
|
if not player.ap.is_playing():
|
|
Transitioned.emit(self, "PlayerCrouch")
|