diff options
author | Henrique Alves <henriquelalves@gmail.com> | 2022-07-17 03:18:59 -0300 |
---|---|---|
committer | Henrique Alves <henriquelalves@gmail.com> | 2022-07-17 03:18:59 -0300 |
commit | 7aedfb8f07481cabf26e1aa48da5fa89e26e4f96 (patch) | |
tree | 64803a3fd23068eb39e0f4175bb9d274f3db312c | |
parent | 9796ffe09423c849430929a509f6615a9f8f5106 (diff) | |
download | gamejam-gmtk-2022-7aedfb8f07481cabf26e1aa48da5fa89e26e4f96.tar.gz gamejam-gmtk-2022-7aedfb8f07481cabf26e1aa48da5fa89e26e4f96.tar.bz2 gamejam-gmtk-2022-7aedfb8f07481cabf26e1aa48da5fa89e26e4f96.zip |
GameOver and Victory
-rw-r--r-- | Assets/joinha.png | bin | 0 -> 176073 bytes | |||
-rw-r--r-- | Assets/joinha.png.import | 35 | ||||
-rw-r--r-- | Scenes/Global.gd | 6 | ||||
-rw-r--r-- | Scenes/Transition.gd | 32 | ||||
-rw-r--r-- | Scenes/Transition.tscn | 250 |
5 files changed, 319 insertions, 4 deletions
diff --git a/Assets/joinha.png b/Assets/joinha.png Binary files differnew file mode 100644 index 0000000..839f83b --- /dev/null +++ b/Assets/joinha.png diff --git a/Assets/joinha.png.import b/Assets/joinha.png.import new file mode 100644 index 0000000..5e140ba --- /dev/null +++ b/Assets/joinha.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/joinha.png-1fab2bc88e4c31a82f1646698de74fc9.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/joinha.png" +dest_files=[ "res://.import/joinha.png-1fab2bc88e4c31a82f1646698de74fc9.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Scenes/Global.gd b/Scenes/Global.gd index 09c935a..84717d1 100644 --- a/Scenes/Global.gd +++ b/Scenes/Global.gd @@ -10,6 +10,12 @@ onready var max_crystals = 0 signal update_ui +func reset(): + turns = STARTING_TURNS + current_stage = 0 + active_crystals = 0 + max_crystals = 0 + func set_turns(t): turns = t emit_signal("update_ui") diff --git a/Scenes/Transition.gd b/Scenes/Transition.gd index 02dee1d..1cd57a6 100644 --- a/Scenes/Transition.gd +++ b/Scenes/Transition.gd @@ -7,14 +7,40 @@ onready var prev_stage = 0 onready var next_stage = 0 func _ready(): + set_process_input(false) prev_stage = Global.current_stage - 1 next_stage = Global.current_stage get_node(dices[prev_stage+1]).show() - yield(animate_next_stage(), "completed") - yield(get_tree().create_timer(2), "timeout") - get_tree().change_scene("res://Scenes/Dungeon.tscn") + if Global.turns > 0: + if prev_stage == 5: + victory() + else: + yield(animate_next_stage(), "completed") + yield(get_tree().create_timer(2), "timeout") + get_tree().change_scene("res://Scenes/Dungeon.tscn") + else: + game_over() + +func victory(): + $UIController/Victory/Label2.text = "You finished the game with %d turns remaining!" % Global.turns + + yield(get_tree().create_timer(1),"timeout") + $UIController/Victory/AnimationPlayer.play("FadeIn") + yield(get_tree().create_timer(1),"timeout") + set_process_input(true) + +func game_over(): + yield(get_tree().create_timer(1),"timeout") + $UIController/GameOver/AnimationPlayer.play("FadeIn") + yield(get_tree().create_timer(1),"timeout") + set_process_input(true) + +func _input(event): + if event is InputEventKey and event.is_pressed(): + Global.reset() + get_tree().change_scene("res://Scenes/Transition.tscn") func animate_next_stage(): var pos0 = $UIController/ArmPivot.rect_position diff --git a/Scenes/Transition.tscn b/Scenes/Transition.tscn index 7d8c5fd..b47cebe 100644 --- a/Scenes/Transition.tscn +++ b/Scenes/Transition.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=19 format=2] +[gd_scene load_steps=27 format=2] [ext_resource path="res://Assets/transition.png" type="Texture" id=1] [ext_resource path="res://Scenes/CameraControl.gd" type="Script" id=2] [ext_resource path="res://Scenes/Transition.gd" type="Script" id=3] +[ext_resource path="res://Assets/joinha.png" type="Texture" id=4] +[ext_resource path="res://Assets/AlegreyaSansSC-ExtraBold.ttf" type="DynamicFontData" id=5] [ext_resource path="res://Assets/arm.png" type="Texture" id=7] [ext_resource path="res://Assets/3_dots.png" type="Texture" id=8] [ext_resource path="res://Assets/DiceFaceMaterial.tres" type="Material" id=9] @@ -36,6 +38,170 @@ background_sky = SubResource( 2 ) ambient_light_color = Color( 1, 1, 1, 1 ) dof_blur_far_amount = 0.06 +[sub_resource type="DynamicFont" id=11] +size = 80 +font_data = ExtResource( 5 ) + +[sub_resource type="DynamicFont" id=12] +size = 60 +font_data = ExtResource( 5 ) + +[sub_resource type="Animation" id=13] +resource_name = "FadeIn" +tracks/0/type = "value" +tracks/0/path = NodePath(".: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.4 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("TextureRect:rect_position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.4, 1 ), +"transitions": PoolRealArray( 0.378929, 0.378929, 1 ), +"update": 0, +"values": [ Vector2( -90, 519 ), Vector2( -90, 519 ), Vector2( 418, 519 ) ] +} +tracks/2/type = "value" +tracks/2/path = NodePath(".:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} + +[sub_resource type="Animation" id=14] +length = 0.001 +tracks/0/type = "value" +tracks/0/path = NodePath(".: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 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("TextureRect:rect_position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( -90, 519 ) ] +} +tracks/2/type = "value" +tracks/2/path = NodePath(".:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ true ] +} + +[sub_resource type="Animation" id=15] +resource_name = "FadeIn" +tracks/0/type = "value" +tracks/0/path = NodePath(".: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.4 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("TextureRect:rect_position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.4, 1 ), +"transitions": PoolRealArray( 1, 0.435275, 1 ), +"update": 0, +"values": [ Vector2( 1044, 119 ), Vector2( 1044, 119 ), Vector2( 618, 119 ) ] +} +tracks/2/type = "value" +tracks/2/path = NodePath(".:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} + +[sub_resource type="Animation" id=16] +length = 0.001 +tracks/0/type = "value" +tracks/0/path = NodePath(".: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 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("TextureRect:rect_position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 1044, 119 ) ] +} +tracks/2/type = "value" +tracks/2/path = NodePath(".:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ true ] +} + [node name="Transition" type="Spatial"] script = ExtResource( 3 ) dices = [ NodePath("Mesh0"), NodePath("Mesh"), NodePath("Mesh2"), NodePath("Mesh3"), NodePath("Mesh4"), NodePath("Mesh5"), NodePath("Mesh6") ] @@ -329,4 +495,86 @@ rect_scale = Vector2( -1, 1 ) texture = ExtResource( 7 ) expand = true +[node name="GameOver" type="ColorRect" parent="UIController"] +modulate = Color( 1, 1, 1, 0 ) +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 0.6 ) + +[node name="Label" type="Label" parent="UIController/GameOver"] +margin_left = 311.0 +margin_top = 17.0 +margin_right = 699.0 +margin_bottom = 97.0 +custom_fonts/font = SubResource( 11 ) +text = "Game Over!" + +[node name="Label2" type="Label" parent="UIController/GameOver"] +margin_left = 555.0 +margin_top = 234.0 +margin_right = 943.0 +margin_bottom = 420.0 +custom_fonts/font = SubResource( 12 ) +text = "Try again +by pressing +any key!" + +[node name="TextureRect" type="TextureRect" parent="UIController/GameOver"] +margin_left = -90.0 +margin_top = 519.0 +margin_right = 361.0 +margin_bottom = 870.0 +rect_rotation = -179.692 +texture = ExtResource( 4 ) +expand = true + +[node name="AnimationPlayer" type="AnimationPlayer" parent="UIController/GameOver"] +anims/FadeIn = SubResource( 13 ) +anims/RESET = SubResource( 14 ) + +[node name="Victory" type="ColorRect" parent="UIController"] +modulate = Color( 1, 1, 1, 0 ) +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 0.6 ) + +[node name="Label" type="Label" parent="UIController/Victory"] +margin_left = 311.0 +margin_top = 17.0 +margin_right = 699.0 +margin_bottom = 97.0 +custom_fonts/font = SubResource( 11 ) +text = "Victory!" +align = 1 + +[node name="Label2" type="Label" parent="UIController/Victory"] +margin_left = 19.0 +margin_top = 212.0 +margin_right = 530.0 +margin_bottom = 398.0 +custom_fonts/font = SubResource( 12 ) +text = "You finished the game with 10 turns remaining!" +autowrap = true + +[node name="Label3" type="Label" parent="UIController/Victory"] +margin_left = 189.0 +margin_top = 510.0 +margin_right = 841.0 +margin_bottom = 696.0 +custom_fonts/font = SubResource( 12 ) +text = "Press any key to restart!" + +[node name="TextureRect" type="TextureRect" parent="UIController/Victory"] +margin_left = 1044.0 +margin_top = 119.0 +margin_right = 1495.0 +margin_bottom = 470.0 +rect_rotation = -0.557316 +texture = ExtResource( 4 ) +expand = true + +[node name="AnimationPlayer" type="AnimationPlayer" parent="UIController/Victory"] +anims/FadeIn = SubResource( 15 ) +anims/RESET = SubResource( 16 ) + [node name="Tween" type="Tween" parent="."] |