no message

This commit is contained in:
2025-06-11 17:54:55 +02:00
parent 4105e75357
commit 69a456db88
38 changed files with 2398 additions and 159 deletions

View File

@ -0,0 +1,38 @@
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