Health and killing zones

This commit is contained in:
2024-10-28 10:25:07 +01:00
parent e242f59c0b
commit a15966a361
9 changed files with 42 additions and 47 deletions

View File

@ -35,9 +35,10 @@ func _on_player_detection_body_exited(body: Node2D) -> void:
func _on_killingzone_body_entered(body: Node2D) -> void:
if body.name == "Player":
if player.global_position.y < self.global_position.y - 10 :
if player.global_position.y < self.global_position.y - 20 :
get_node("AnimatedSprite2D").play("death")
alive = false
self.collision_mask = 2
timer.start()
elif alive:
print("HURT")

View File

@ -139,7 +139,7 @@ shape = SubResource("CapsuleShape2D_o6lk6")
debug_color = Color(0.987816, 0.0454308, 0.255515, 0.42)
[node name="Deathcounter" type="Timer" parent="."]
wait_time = 0.6
wait_time = 2.0
[connection signal="body_entered" from="PlayerDetection" to="." method="_on_player_detection_body_entered"]
[connection signal="body_exited" from="PlayerDetection" to="." method="_on_player_detection_body_exited"]