Fix unintuitive behavior of wall jump. Also fix jump sound always being interrupted by immediate landing sound.
This commit is contained in:
		
							parent
							
								
									e08206c7c8
								
							
						
					
					
						commit
						147806124b
					
				| 
						 | 
				
			
			@ -1079,7 +1079,7 @@ func _on_jump_state_tick(delta: float) -> void:
 | 
			
		|||
	_do_standard_motion(delta)
 | 
			
		||||
	if !jump_impetus:
 | 
			
		||||
		_apply_jump_deceleration(delta)
 | 
			
		||||
	if is_really_grounded():
 | 
			
		||||
	if is_really_grounded() && !state_coyote_time_active():
 | 
			
		||||
		play_sound(_landing_sound, _landing_sound_volume_db)
 | 
			
		||||
		state = &'run'
 | 
			
		||||
	elif linear_velocity.dot(ground_normal) <= -0.25:
 | 
			
		||||
| 
						 | 
				
			
			@ -1094,7 +1094,7 @@ func _on_jump_state_tick(delta: float) -> void:
 | 
			
		|||
 | 
			
		||||
func _on_fall_state_tick(delta: float) -> void:
 | 
			
		||||
	_do_standard_motion(delta)
 | 
			
		||||
	if is_really_grounded():
 | 
			
		||||
	if is_really_grounded() && !state_coyote_time_active():
 | 
			
		||||
		play_sound(_landing_sound, _landing_sound_volume_db)
 | 
			
		||||
		state = &'run'
 | 
			
		||||
	elif is_touching_wall():
 | 
			
		||||
| 
						 | 
				
			
			@ -1136,8 +1136,9 @@ func _on_skid_state_tick(delta: float) -> void:
 | 
			
		|||
func _on_wall_slide_state_tick(delta: float) -> void:
 | 
			
		||||
	_do_standard_motion(delta)
 | 
			
		||||
	if jump_impetus && _state_coyote_time <= 0.0:
 | 
			
		||||
		ground_normal = (ground_normal + wall_normal).normalized()
 | 
			
		||||
		force_change_state(&'jump')
 | 
			
		||||
		# in addition, not instead:
 | 
			
		||||
		apply_central_impulse(mass*_get_jump_initial_velocity()*wall_normal)
 | 
			
		||||
	elif is_really_grounded():
 | 
			
		||||
		state = &'run'
 | 
			
		||||
	elif !is_touching_wall():
 | 
			
		||||
| 
						 | 
				
			
			@ -1239,7 +1240,7 @@ func _on_jump_while_holding_state_tick(delta: float) -> void:
 | 
			
		|||
	_do_standard_motion(delta)
 | 
			
		||||
	if !jump_impetus:
 | 
			
		||||
		_apply_jump_deceleration(delta)
 | 
			
		||||
	if is_really_grounded():
 | 
			
		||||
	if is_really_grounded() && !state_coyote_time_active():
 | 
			
		||||
		play_sound(_landing_sound, _landing_sound_volume_db)
 | 
			
		||||
		state = &'run-while-holding'
 | 
			
		||||
	elif linear_velocity.dot(ground_normal) <= -0.25:
 | 
			
		||||
| 
						 | 
				
			
			@ -1247,7 +1248,7 @@ func _on_jump_while_holding_state_tick(delta: float) -> void:
 | 
			
		|||
 | 
			
		||||
func _on_fall_while_holding_state_tick(delta: float) -> void:
 | 
			
		||||
	_do_standard_motion(delta)
 | 
			
		||||
	if is_really_grounded():
 | 
			
		||||
	if is_really_grounded() && !state_coyote_time_active():
 | 
			
		||||
		play_sound(_landing_sound, _landing_sound_volume_db)
 | 
			
		||||
		state = &'run-while-holding'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue