fixed a few bugs with drowning

This commit is contained in:
pennyrigate 2023-06-30 06:00:29 -04:00
parent 13f01397ef
commit 843561915c
2 changed files with 15 additions and 1 deletions

View file

@ -262,6 +262,7 @@ func _on_Dead_state_entered() -> void:
func _on_Drowning_state_entered() -> void:
state_chart.send_event("died")
velocity = Vector2.ZERO
animation_player.play("drown")
func _on_Respawn_state_entered() -> void:
@ -400,7 +401,7 @@ func _process_movement(delta: float) -> void:
func _process_floating_up(delta: float) -> void:
graphics.global_position.y -= 50.0 * delta
var sprite_sector = Game.get_sector(Vector2(global_position.x, graphics.global_position.y))
var sprite_sector = Game.get_sector(Vector2(global_position.x, graphics.global_position.y - 20))
if sprite_sector != Game.current_sector:
graphics.visible = false
graphics.position = Vector2.ZERO

View file

@ -336,6 +336,18 @@ tracks/4/keys = {
"method": "send_event"
} ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Graphics/Sprite:rotation_degrees")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
[sub_resource type="Animation" id=20]
resource_name = "duck"
@ -1548,5 +1560,6 @@ align = 1
[connection signal="state_entered" from="StateChart/Root/Health/Respawn" to="." method="_on_Respawn_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Health/Dead" to="." method="_on_Dead_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Health/Drowning" to="." method="_on_Drowning_state_entered"]
[connection signal="state_exited" from="StateChart/Root/Health/Drowning" to="." method="_on_Drowning_state_exited"]
[connection signal="state_physics_processing" from="StateChart/Root/Health/Drowning/FloatingUp" to="." method="_process_floating_up"]
[connection signal="timeout" from="OxygenTimer" to="." method="_on_OxygenTimer_timeout"]