diff --git a/res/themes/default.tres b/res/themes/default.tres index 41f81a2..f806a20 100644 --- a/res/themes/default.tres +++ b/res/themes/default.tres @@ -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] diff --git a/src/models/enemies/rat/Rat.tscn b/src/models/enemies/rat/Rat.tscn index a08cff9..4bbe4eb 100644 --- a/src/models/enemies/rat/Rat.tscn +++ b/src/models/enemies/rat/Rat.tscn @@ -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 diff --git a/src/scenes/death/Death.tscn b/src/scenes/death/Death.tscn new file mode 100644 index 0000000..6c5b6ad --- /dev/null +++ b/src/scenes/death/Death.tscn @@ -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"] diff --git a/src/scenes/death/death.gd b/src/scenes/death/death.gd new file mode 100644 index 0000000..626e274 --- /dev/null +++ b/src/scenes/death/death.gd @@ -0,0 +1,7 @@ +extends Node2D + +func _ready(): + AudioDead.play() + +func animation_finished(anim_name): + Global.return_to_menu() diff --git a/src/scenes/game/Game.tscn b/src/scenes/game/Game.tscn index 35236a6..be717e9 100644 --- a/src/scenes/game/Game.tscn +++ b/src/scenes/game/Game.tscn @@ -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 ) diff --git a/src/scripts/enemy_class.gd b/src/scripts/enemy_class.gd index 7135964..0283a41 100644 --- a/src/scripts/enemy_class.gd +++ b/src/scripts/enemy_class.gd @@ -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 diff --git a/src/scripts/global.gd b/src/scripts/global.gd index f97d291..dfc65ab 100644 --- a/src/scripts/global.gd +++ b/src/scripts/global.gd @@ -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()