Jump adjustments for crap jumps.
This commit is contained in:
parent
a195e7be2d
commit
9cf13cc5b8
|
|
@ -356,7 +356,7 @@ func _state_process_physics_fall():
|
||||||
func _state_process_physics_jump():
|
func _state_process_physics_jump():
|
||||||
|
|
||||||
flip_sprite_to_movement_direction()
|
flip_sprite_to_movement_direction()
|
||||||
|
|
||||||
#Apparently we're instantly landing
|
#Apparently we're instantly landing
|
||||||
# if parent.is_on_floor():
|
# if parent.is_on_floor():
|
||||||
# #modifier.reference()
|
# #modifier.reference()
|
||||||
|
|
@ -373,6 +373,15 @@ func _state_process_physics_jump():
|
||||||
apply_state_modifier(current_state.get_movement_parameters()),
|
apply_state_modifier(current_state.get_movement_parameters()),
|
||||||
desired_movement_vector )
|
desired_movement_vector )
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## Just slightly bump away from ledge we're bumping into
|
||||||
|
if (($"%JumpAdjustorBack".is_colliding() and !$"%JumpAdjustorFront".is_colliding()) or
|
||||||
|
(!$"%JumpAdjustorBack".is_colliding() and $"%JumpAdjustorFront".is_colliding())):
|
||||||
|
if $"%JumpAdjustorBack".is_colliding():
|
||||||
|
parent.global_position.x += sign(parent.transform.x.x)
|
||||||
|
else:
|
||||||
|
parent.global_position.x += sign(parent.transform.x.x * -1)
|
||||||
|
|
||||||
|
|
||||||
func _state_process_physics_move():
|
func _state_process_physics_move():
|
||||||
# flip sprite in direction
|
# flip sprite in direction
|
||||||
|
|
|
||||||
|
|
@ -105,7 +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 = "ledge-grab"
|
animation = "jump"
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_aseprite_wizard_config_": {
|
"_aseprite_wizard_config_": {
|
||||||
|
|
@ -143,7 +143,21 @@ position = Vector2( 6, -16 )
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 4, 4 )
|
cast_to = Vector2( 4, 4 )
|
||||||
|
|
||||||
[node name="LadderDetector" type="RayCast2D" parent="." index="6"]
|
[node name="JumpAdjustorBack" type="RayCast2D" parent="." index="6"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
modulate = Color( 0, 1, 0, 1 )
|
||||||
|
position = Vector2( -8, -12 )
|
||||||
|
enabled = true
|
||||||
|
cast_to = Vector2( 5, -14 )
|
||||||
|
|
||||||
|
[node name="JumpAdjustorFront" type="RayCast2D" parent="." index="7"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
modulate = Color( 0, 1, 0, 1 )
|
||||||
|
position = Vector2( 7, -12 )
|
||||||
|
enabled = true
|
||||||
|
cast_to = Vector2( -5, -14 )
|
||||||
|
|
||||||
|
[node name="LadderDetector" type="RayCast2D" parent="." index="8"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
modulate = Color( 0, 1, 0, 1 )
|
modulate = Color( 0, 1, 0, 1 )
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
@ -152,25 +166,25 @@ collision_mask = 1024
|
||||||
collide_with_areas = true
|
collide_with_areas = true
|
||||||
collide_with_bodies = false
|
collide_with_bodies = false
|
||||||
|
|
||||||
[node name="AudioStreamPlayer_StateReceiver" parent="." index="7"]
|
[node name="AudioStreamPlayer_StateReceiver" parent="." index="9"]
|
||||||
sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ]
|
sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ]
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="8"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="10"]
|
||||||
position = Vector2( 0, 2 )
|
position = Vector2( 0, 2 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
script = ExtResource( 31 )
|
script = ExtResource( 31 )
|
||||||
callable_state_machine = NodePath("../Movement_StateMachine")
|
callable_state_machine = NodePath("../Movement_StateMachine")
|
||||||
|
|
||||||
[node name="Health_Component" parent="." index="9" instance=ExtResource( 17 )]
|
[node name="Health_Component" parent="." index="11" instance=ExtResource( 17 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
max_health = 100
|
max_health = 100
|
||||||
|
|
||||||
[node name="Stamina_Component" parent="." index="10" instance=ExtResource( 29 )]
|
[node name="Stamina_Component" parent="." index="12" instance=ExtResource( 29 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
max_stamina = 50
|
max_stamina = 50
|
||||||
recovery_rate = 2
|
recovery_rate = 2
|
||||||
|
|
||||||
[node name="Hurtbox_Component" parent="." index="11" instance=ExtResource( 16 )]
|
[node name="Hurtbox_Component" parent="." index="13" instance=ExtResource( 16 )]
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 128
|
collision_mask = 128
|
||||||
hurtbox_entered_function = "hit_Receiver"
|
hurtbox_entered_function = "hit_Receiver"
|
||||||
|
|
@ -182,13 +196,13 @@ shape = SubResource( 2 )
|
||||||
script = ExtResource( 34 )
|
script = ExtResource( 34 )
|
||||||
callable_state_machine = NodePath("../../Movement_StateMachine")
|
callable_state_machine = NodePath("../../Movement_StateMachine")
|
||||||
|
|
||||||
[node name="Interactable_Receiver" type="Node" parent="." index="12"]
|
[node name="Interactable_Receiver" type="Node" parent="." index="14"]
|
||||||
script = ExtResource( 21 )
|
script = ExtResource( 21 )
|
||||||
interactable_parent_callback = "touch_the_thing"
|
interactable_parent_callback = "touch_the_thing"
|
||||||
|
|
||||||
[node name="PewMachine" parent="." index="13" instance=ExtResource( 28 )]
|
[node name="PewMachine" parent="." index="15" instance=ExtResource( 28 )]
|
||||||
|
|
||||||
[node name="Hitbox_Component" parent="." index="14" instance=ExtResource( 33 )]
|
[node name="Hitbox_Component" parent="." index="16" instance=ExtResource( 33 )]
|
||||||
collision_layer = 192
|
collision_layer = 192
|
||||||
damage_amount = 10
|
damage_amount = 10
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user