newest Version as of right now
This commit is contained in:
29
sidescroller/scripts/playerroll.gd
Normal file
29
sidescroller/scripts/playerroll.gd
Normal file
@ -0,0 +1,29 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user