Snapping to ledge a little better on grab, jump height test in first clonebox

This commit is contained in:
Dustin 2025-06-01 10:34:27 -07:00
parent d934c815e0
commit a195e7be2d
3 changed files with 14 additions and 4 deletions

View File

@ -453,6 +453,9 @@ func _state_process_physics_ledge_grab():
UiManager.debug_text = (str(velocity_controller.velocity)) UiManager.debug_text = (str(velocity_controller.velocity))
$"%LedgeDetector".set_enabled(false) $"%LedgeDetector".set_enabled(false)
var foo = $"%LedgeDetector".is_colliding()
var bar = $"%WallDetector".is_colliding()
if _wants_jump: if _wants_jump:
request_state_change.call_func('ledge_climb') request_state_change.call_func('ledge_climb')
return return
@ -461,6 +464,14 @@ func _state_process_physics_ledge_grab():
request_state_change.call_func('fall') request_state_change.call_func('fall')
return return
var move_downward = 0.0
if !$"%WallDetector".is_colliding():
move_downward = 1.0
parent.global_position.y += move_downward
## Trend towart the ledge
parent.move_and_slide(Vector2(sign(parent.transform.x.x) * 1, 0),Vector2.UP)
func _state_process_physics_ledge_climb(): func _state_process_physics_ledge_climb():
# $"../LedgeDetector".set_enabled(false) # $"../LedgeDetector".set_enabled(false)

View File

@ -105,8 +105,7 @@ states = [ ExtResource( 4 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8
[node name="AnimatedSprite_StateReceiver" parent="." index="1"] [node name="AnimatedSprite_StateReceiver" parent="." index="1"]
frames = ExtResource( 2 ) frames = ExtResource( 2 )
animation = "attack-punch" animation = "ledge-grab"
frame = 7
script = ExtResource( 5 ) script = ExtResource( 5 )
__meta__ = { __meta__ = {
"_aseprite_wizard_config_": { "_aseprite_wizard_config_": {
@ -140,7 +139,7 @@ cast_to = Vector2( 4, -1 )
[node name="WallDetector" type="RayCast2D" parent="." index="5"] [node name="WallDetector" type="RayCast2D" parent="." index="5"]
unique_name_in_owner = true unique_name_in_owner = true
modulate = Color( 0, 1, 0, 1 ) modulate = Color( 0, 1, 0, 1 )
position = Vector2( 6, -18 ) position = Vector2( 6, -16 )
enabled = true enabled = true
cast_to = Vector2( 4, 4 ) cast_to = Vector2( 4, 4 )

View File

@ -14,7 +14,7 @@ z_index = -2
[node name="TileMap Collision" parent="." index="1"] [node name="TileMap Collision" parent="." index="1"]
tile_set = ExtResource( 2 ) tile_set = ExtResource( 2 )
tile_data = PoolIntArray( -262145, 4, 65536, -327661, 4, 65536, -196609, 4, 65536, -262125, 4, 65536, -131073, 4, 0, -196589, 4, 65536, -65537, 4, 0, -131053, 4, 65536, -1, 4, 0, -65517, 4, 65536, 65533, 4, 0, 65534, 4, 0, 65535, 4, 0, 19, 4, 0, 20, 4, 65536, 21, 4, 65536, 22, 4, 65536, 131069, 4, 0, 65558, 4, 65536, 196605, 4, 0, 131094, 4, 65536, 262141, 4, 0, 196609, 2, 1, 196610, 2, 2, 196625, 2, 0, 196626, 2, 1, 196630, 4, 65536, 327677, 4, 0, 327678, 4, 0, 327679, 4, 0, 262144, 4, 65536, 262145, 2, 65537, 262146, 2, 65538, 262161, 2, 65536, 262162, 2, 65537, 262163, 4, 65536, 262164, 4, 65536, 262165, 4, 65536, 262166, 4, 65536, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 393235, 4, 65536, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 ) tile_data = PoolIntArray( -262145, 4, 65536, -327661, 4, 65536, -196609, 4, 65536, -262125, 4, 65536, -131073, 4, 0, -196589, 4, 65536, -65537, 4, 0, -131053, 4, 65536, -1, 4, 0, -65517, 4, 65536, 65533, 4, 0, 65534, 4, 0, 65535, 4, 0, 19, 4, 0, 20, 4, 65536, 21, 4, 65536, 22, 4, 65536, 131069, 4, 0, 65558, 4, 65536, 196605, 4, 0, 131094, 4, 65536, 262141, 4, 0, 196609, 2, 1, 196610, 2, 2, 196625, 2, 0, 196626, 2, 1, 196630, 4, 65536, 327677, 4, 0, 327678, 4, 0, 327679, 4, 0, 262144, 4, 65536, 262145, 2, 65537, 262146, 2, 65538, 262161, 2, 65536, 262162, 2, 65537, 262163, 4, 65536, 262164, 4, 65536, 262165, 4, 65536, 262166, 4, 65536, 327680, 4, 65536, 327699, 4, 65536, 393216, 4, 65536, 393232, 4, 65536, 393233, 4, 65536, 393234, 4, 65536, 393235, 4, 65536, 458752, 4, 65536, 458768, 4, 65536, 458769, 4, 65536, 458770, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 4, 65536, 524305, 4, 65536, 524306, 4, 65536, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
[node name="TileMap Foreground" parent="." index="2"] [node name="TileMap Foreground" parent="." index="2"]
tile_set = ExtResource( 2 ) tile_set = ExtResource( 2 )