extends State class_name PlayerLedgeGrab var ledge_cshape = preload("res://resources/player ledge cshape.tres") var standing_cshape = preload("res://resources/player standing cshape.tres") func get_state_name(): return str(self).split(":")[0] func enter(): if player.wallcheckright.is_colliding() and player.facing_direction == -1: player.set_facing_direction(1) elif player.wallcheckleft.is_colliding() and player.facing_direction == 1: player.set_facing_direction(-1) player.ap.play("ledge hang") player.sprite.position.x = player.facing_direction * 11 player.sprite.position.y = -54 player.cshape.shape = ledge_cshape player.cshape.position.y = -55 func exit(): player.cshape.shape = standing_cshape player.cshape.position.y = -43 player.sprite.position.x = 0 player.sprite.position.y = -48 func update(delta): if Input.is_action_just_pressed("jump"): Transitioned.emit(self, "PlayerClimbUp") elif player.floorcheck.is_colliding() or (!player.wallcheckright.is_colliding() and !player.wallcheckleft.is_colliding()) or Input.is_action_pressed("crouch"): Transitioned.emit(self, "PlayerFall") func physics_update(delta): pass