From ed567bda49ed674c8995309fb905d6df10185724 Mon Sep 17 00:00:00 2001 From: Jonas Bernard Date: Mon, 26 Apr 2021 18:45:58 +0200 Subject: Game Over --- ...e_over.png-de5b910a8c07fb0669574bb9ab6e36dd.md5 | 2 +- ..._over.png-de5b910a8c07fb0669574bb9ab6e36dd.stex | Bin 8188 -> 8188 bytes scenes/game_over.gd | 5 +++ scenes/game_over.tscn | 37 +++++++++++++++++++++ scenes/levels/base_level.gd | 4 +-- scenes/menu.tscn | 1 - textures/texts/game_over.png.import | 2 +- 7 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 scenes/game_over.gd create mode 100644 scenes/game_over.tscn diff --git a/.import/game_over.png-de5b910a8c07fb0669574bb9ab6e36dd.md5 b/.import/game_over.png-de5b910a8c07fb0669574bb9ab6e36dd.md5 index dde93d3..3d9b482 100644 --- a/.import/game_over.png-de5b910a8c07fb0669574bb9ab6e36dd.md5 +++ b/.import/game_over.png-de5b910a8c07fb0669574bb9ab6e36dd.md5 @@ -1,3 +1,3 @@ source_md5="99e0c3fb7cb38fdb04e2131ac671ad1a" -dest_md5="f8448661c4d3091857ee81c9f9ab8b64" +dest_md5="dfed894a226c0b3be8dfce49f816abff" diff --git a/.import/game_over.png-de5b910a8c07fb0669574bb9ab6e36dd.stex b/.import/game_over.png-de5b910a8c07fb0669574bb9ab6e36dd.stex index ed15eb7..4ba0b1a 100644 Binary files a/.import/game_over.png-de5b910a8c07fb0669574bb9ab6e36dd.stex and b/.import/game_over.png-de5b910a8c07fb0669574bb9ab6e36dd.stex differ diff --git a/scenes/game_over.gd b/scenes/game_over.gd new file mode 100644 index 0000000..0d1787a --- /dev/null +++ b/scenes/game_over.gd @@ -0,0 +1,5 @@ +extends Node2D + + +func _on_AnimationPlayer_animation_finished(anim_name): + get_tree().change_scene("res://scenes/menu.tscn") diff --git a/scenes/game_over.tscn b/scenes/game_over.tscn new file mode 100644 index 0000000..1a0aa37 --- /dev/null +++ b/scenes/game_over.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://textures/texts/game_over.png" type="Texture" id=1] +[ext_resource path="res://scenes/game_over.gd" type="Script" id=2] +[ext_resource path="res://textures/backgrounds/background_grey.png" type="Texture" id=3] + +[sub_resource type="Animation" id=1] +resource_name = "fly" +length = 3.048 +tracks/0/type = "bezier" +tracks/0/path = NodePath("Sprite:position:y") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"points": PoolRealArray( 92.8571, -0.25, 0, 0.47, 446.97, -924.456, -0.52, -186.363, 0.25, 0 ), +"times": PoolRealArray( 2, 3 ) +} + +[node name="Node2D" type="Node2D"] +position = Vector2( 403.175, 267.103 ) +script = ExtResource( 2 ) + +[node name="Sprite2" type="Sprite" parent="."] +position = Vector2( 194.362, 97.3519 ) +texture = ExtResource( 3 ) + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 230.523, 73.7867 ) +scale = Vector2( 1.06474, 1.06474 ) +texture = ExtResource( 1 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +autoplay = "fly" +anims/fly = SubResource( 1 ) +[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"] diff --git a/scenes/levels/base_level.gd b/scenes/levels/base_level.gd index 66085c5..29f72d7 100644 --- a/scenes/levels/base_level.gd +++ b/scenes/levels/base_level.gd @@ -47,8 +47,8 @@ func _on_Level_lost_heart(instakill): if instakill: _health = 0 _health -= 1 - if _health == 0: - pass # TODO: lose scenario + if _health <= 0: + get_tree().change_scene("res://scenes/game_over.tscn") _health_bar.set_health(_health) func _load_next_level(): diff --git a/scenes/menu.tscn b/scenes/menu.tscn index 3828ad6..48707b6 100644 --- a/scenes/menu.tscn +++ b/scenes/menu.tscn @@ -194,7 +194,6 @@ anims/startgame = SubResource( 2 ) [node name="Outgoing" type="AnimationPlayer" parent="."] anims/tointro = SubResource( 3 ) anims/tosettings = SubResource( 4 ) - [connection signal="on_click" from="Content/Back" to="." method="_on_Back_on_click"] [connection signal="on_click" from="Content/HardMode" to="." method="_on_HardMode_on_click"] [connection signal="on_click" from="Content/Exit" to="." method="_on_Exit_on_click"] diff --git a/textures/texts/game_over.png.import b/textures/texts/game_over.png.import index c7228ca..39ff516 100644 --- a/textures/texts/game_over.png.import +++ b/textures/texts/game_over.png.import @@ -20,7 +20,7 @@ compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 flags/repeat=0 -flags/filter=true +flags/filter=false flags/mipmaps=false flags/anisotropic=false flags/srgb=2 -- cgit