Fix Death

main
Luna Brovchuk 2023-10-02 20:18:04 +02:00
parent 59b53c3200
commit c513c48f8b
7 changed files with 70 additions and 54 deletions

View File

@ -3,7 +3,6 @@
[ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" id=1]
[sub_resource type="DynamicFont" id=1]
size = 8
font_data = ExtResource( 1 )
[resource]

View File

@ -16,7 +16,7 @@ use_parent_material = true
position = Vector2( -3, 0 )
frames = ExtResource( 1 )
animation = "idle"
frame = 3
frame = 1
playing = true
centered = false

View File

@ -0,0 +1,55 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/scenes/game/sprites/gameover.png" type="Texture" id=1]
[ext_resource path="res://src/scenes/death/death.gd" type="Script" id=2]
[sub_resource type="Animation" id=1]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ) ]
}
[sub_resource type="Animation" id=2]
resource_name = "gameover"
length = 3.0
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1.5, 3 ),
"transitions": PoolRealArray( 29.8571, 2, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 0, 0, 0, 1 ) ]
}
[node name="Death" type="Node2D"]
script = ExtResource( 2 )
[node name="Gameover" type="Control" parent="."]
margin_right = 320.0
margin_bottom = 180.0
mouse_filter = 2
[node name="Sprite" type="Sprite" parent="Gameover"]
modulate = Color( 1, 1, 1, 0 )
texture = ExtResource( 1 )
centered = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="Gameover"]
autoplay = "gameover"
anims/RESET = SubResource( 1 )
anims/gameover = SubResource( 2 )
[connection signal="animation_finished" from="Gameover/AnimationPlayer" to="." method="animation_finished"]

View File

@ -0,0 +1,7 @@
extends Node2D
func _ready():
AudioDead.play()
func animation_finished(anim_name):
Global.return_to_menu()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=27 format=2]
[gd_scene load_steps=24 format=2]
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
@ -14,7 +14,6 @@
[ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12]
[ext_resource path="res://src/scenes/game/sprites/hatch1.png" type="Texture" id=13]
[ext_resource path="res://src/scenes/game/sprites/hatch2.png" type="Texture" id=14]
[ext_resource path="res://src/scenes/game/sprites/gameover.png" type="Texture" id=15]
[ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16]
[ext_resource path="res://src/scenes/game/sprites/stun/stun_spriteframes.tres" type="SpriteFrames" id=17]
[ext_resource path="res://src/models/card/Card.tscn" type="PackedScene" id=18]
@ -29,37 +28,6 @@ extents = Vector2( 10, 60 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 140, 10.125 )
[sub_resource type="Animation" id=5]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ) ]
}
[sub_resource type="Animation" id=6]
resource_name = "gameover"
length = 3.0
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 1.5, 3 ),
"transitions": PoolRealArray( 3.24901, 29.8571, 2, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 0, 0, 0, 1 ) ]
}
[node name="Game" type="Node"]
script = ExtResource( 11 )
@ -327,17 +295,3 @@ id = 2
[node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/RightPlaceholder"]
stream = ExtResource( 9 )
[node name="Gameover" type="Control" parent="UIWrapper/UI"]
margin_right = 320.0
margin_bottom = 180.0
mouse_filter = 2
[node name="Sprite" type="Sprite" parent="UIWrapper/UI/Gameover"]
modulate = Color( 1, 1, 1, 0 )
texture = ExtResource( 15 )
centered = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="UIWrapper/UI/Gameover"]
anims/RESET = SubResource( 5 )
anims/gameover = SubResource( 6 )

View File

@ -56,6 +56,7 @@ func _physics_process(delta):
poison_damage = 0
if poisoned_damage_timer >= 1:
deal_damage(poison_damage)
poisoned_damage_timer = 0
if freeze_modifier != 1:
frozen_timer += delta

View File

@ -1,5 +1,6 @@
extends Node
var DEATH_SCENE = preload("res://src/scenes/death/Death.tscn")
var GAME_SCENE = preload("res://src/scenes/game/Game.tscn")
var MENU_SCENE = preload("res://src/scenes/menu/Menu.tscn")
@ -10,6 +11,9 @@ var health = 5
func game_start():
get_tree().change_scene_to(GAME_SCENE)
func death_scene():
get_tree().change_scene_to(DEATH_SCENE)
func return_to_menu():
playing = false
get_tree().change_scene_to(MENU_SCENE)
@ -19,9 +23,5 @@ func add_health(amount):
get_tree().get_root().get_node("Game/UIWrapper/UI/Left/Health/HealthSprite").frame = health
if health == 0:
playing = false
AudioDead.play()
get_tree().get_root().get_node("Game/View/Enemies").free()
var animplayer = get_tree().get_root().get_node("Game/UIWrapper/UI/Gameover/AnimationPlayer")
animplayer.play("gameover")
yield(animplayer, "animation_finished")
return_to_menu()
death_scene()