newest Version as of right now
This commit is contained in:
@ -9,38 +9,57 @@ var standing_cshape = preload("res://resources/player standing cshape.tres")
|
||||
|
||||
func enter():
|
||||
|
||||
player.climbup_pos1 = player.position + Vector2(0, -52)
|
||||
player.climbup_pos2 = player.position + Vector2(player.facing_direction * 40, -52)
|
||||
|
||||
print(player.position)
|
||||
print (player.climbup_pos1)
|
||||
|
||||
player.ap.play("climb up")
|
||||
player.ap.playback_process_mode = AnimationPlayer.ANIMATION_PROCESS_MANUAL #rootmotion
|
||||
var root_node := player.get_node("RootMotion") #rootmotion
|
||||
|
||||
player.rootmotion_prev = root_node.position #rootmotion
|
||||
|
||||
player.sprite.position.x = player.facing_direction * 11
|
||||
player.sprite.position.y = -60
|
||||
|
||||
player.cshape.shape = ledge_cshape
|
||||
player.cshape.position.y = -69
|
||||
|
||||
player.z_index = 10
|
||||
|
||||
func exit():
|
||||
player.cshape.shape = standing_cshape
|
||||
player.cshape.position.y = -43
|
||||
player.ap.playback_process_mode = AnimationPlayer.ANIMATION_PROCESS_IDLE #rootmotion
|
||||
player.RootMotion.position = Vector2(11, -60) #rootmotion
|
||||
player.rootmotion_prev = Vector2(11, -60) #rootmotion
|
||||
|
||||
player.sprite.position.x = 0
|
||||
player.sprite.position.y = -48
|
||||
|
||||
player.climbup_pos1_reached = false
|
||||
player.cshape.shape = standing_cshape
|
||||
player.cshape.position.y = -43
|
||||
|
||||
player.z_index = 0
|
||||
|
||||
func update(delta):
|
||||
pass
|
||||
|
||||
func physics_update(delta):
|
||||
|
||||
if player.position != player.climbup_pos1 && !player.climbup_pos1_reached:
|
||||
player.position = player.position.move_toward(player.climbup_pos1, player.climbup_speed_y * delta)
|
||||
if player.position == player.climbup_pos1:
|
||||
player.climbup_pos1_reached = true
|
||||
elif player.position != player.climbup_pos2 && player.climbup_pos1_reached:
|
||||
player.position = player.position.move_toward(player.climbup_pos2, player.climbup_speed_x * delta)
|
||||
elif player.position == player.climbup_pos2:
|
||||
Transitioned.emit(self, "PlayerFall")
|
||||
player.jumpbuffer(delta)
|
||||
|
||||
player.ap.advance(delta)
|
||||
|
||||
var current_root_pos = player.RootMotion.position #rootmotion
|
||||
var root_delta = current_root_pos - player.rootmotion_prev #rootmotion
|
||||
|
||||
player.position += Vector2(root_delta.x * player.facing_direction, root_delta.y)
|
||||
player.rootmotion_prev = current_root_pos #rootmotion
|
||||
|
||||
if not player.ap.is_playing():
|
||||
Transitioned.emit(self, "PlayerFall")
|
||||
|
||||
#ursprüngliches manuelles bewegen des players während dem Climb up:
|
||||
#if player.position != player.climbup_pos1 && !player.climbup_pos1_reached:
|
||||
#player.position = player.position.move_toward(player.climbup_pos1, player.climbup_speed_y * delta)
|
||||
#if player.position == player.climbup_pos1:
|
||||
#player.climbup_pos1_reached = true
|
||||
#elif player.position != player.climbup_pos2 && player.climbup_pos1_reached:
|
||||
#player.position = player.position.move_toward(player.climbup_pos2, player.climbup_speed_x * delta)
|
||||
#elif player.position == player.climbup_pos2:
|
||||
#Transitioned.emit(self, "PlayerFall")
|
||||
|
||||
Reference in New Issue
Block a user