diff options
author | Henrique Alves <henrique.alves@itsjungle.xyz> | 2024-01-28 15:22:47 +0200 |
---|---|---|
committer | Henrique Alves <henrique.alves@itsjungle.xyz> | 2024-01-28 15:22:47 +0200 |
commit | 39c5ed20a2eed5e5f358e2f00956f833ba60373b (patch) | |
tree | 7dea8a00015e2fbd78bd6653a2a378e07c0089c5 | |
parent | 5aa179deaa7cfc35b5bbc6abfba348deb0cc7017 (diff) | |
download | gamejam-ggj-2024-39c5ed20a2eed5e5f358e2f00956f833ba60373b.tar.gz gamejam-ggj-2024-39c5ed20a2eed5e5f358e2f00956f833ba60373b.tar.bz2 gamejam-ggj-2024-39c5ed20a2eed5e5f358e2f00956f833ba60373b.zip |
added lives
-rw-r--r-- | game/main.gd | 24 | ||||
-rw-r--r-- | game/main.tscn | 33 | ||||
-rw-r--r-- | game/menu.gd | 12 | ||||
-rw-r--r-- | game/menu.tscn | 77 | ||||
-rw-r--r-- | game/shared/characters/character_animation.gd | 6 | ||||
-rw-r--r-- | game/shared/characters/character_animation.tscn | 61 | ||||
-rw-r--r-- | game/transition/transition.gd | 14 | ||||
-rw-r--r-- | game/transition/transition.tscn | 76 |
8 files changed, 276 insertions, 27 deletions
diff --git a/game/main.gd b/game/main.gd index 6d95c1e..ebffaac 100644 --- a/game/main.gd +++ b/game/main.gd @@ -18,7 +18,7 @@ var _starting = true var _won_last_microgame = false var _microgame_count = 1 var _microgame_idx = 0 - +var lives = 4 func _ready() -> void: randomize() @@ -43,7 +43,18 @@ func _ready() -> void: _current_microgame.queue_free() await transition.play_result_animation(_won_last_microgame) - + + if not _won_last_microgame: + await get_tree().create_timer(0.5).timeout + transition.lose_life() + lives -= 1 + + if lives == 0: + await get_tree().create_timer(0.5).timeout + %FadeAnimationPlayer.play_backwards("fade_in") + await %FadeAnimationPlayer.animation_finished + get_tree().change_scene_to_file("res://game/menu.tscn") + _current_microgame = MICROGAMES[_microgame_idx].instantiate() _microgame_idx = (_microgame_idx + 1) % MICROGAMES.size() if _microgame_idx == 0: @@ -54,11 +65,14 @@ func _ready() -> void: await transition.play_microgame_count(_microgame_count) - #if not Session.shown_types.has(_current_microgame.microgame_control): - #await instruction_popup.play_instruction(_current_microgame.microgame_control) - #Session.shown_types[_current_microgame.microgame_control] = true + if not Session.shown_types.has(_current_microgame.microgame_control): + await instruction_popup.play_instruction(_current_microgame.microgame_control) + Session.shown_types[_current_microgame.microgame_control] = true + + await transition.show_instruction(instruction_popup.get_instruction(_current_microgame.microgame_control)) await transition.microgame_fade_in() + %MicrogameTvTimer.play() _current_microgame.process_mode = Node.PROCESS_MODE_INHERIT diff --git a/game/main.tscn b/game/main.tscn index f315a69..c6158b8 100644 --- a/game/main.tscn +++ b/game/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=30 format=3 uid="uid://culqaacu08vye"] +[gd_scene load_steps=33 format=3 uid="uid://culqaacu08vye"] [ext_resource type="Script" path="res://game/main.gd" id="1_i86db"] [ext_resource type="PackedScene" uid="uid://u3g8s4kck61t" path="res://game/transition/transition.tscn" id="2_xhsf2"] @@ -6,8 +6,11 @@ [ext_resource type="Script" path="res://game/instruction_resource.gd" id="4_30kv1"] [ext_resource type="Texture2D" uid="uid://dv4646lxakb8d" path="res://game/shared/tutorial/assets/Img_maos_trocadas.png" id="4_xg44k"] [ext_resource type="Texture2D" uid="uid://b81bbfen65gm3" path="res://game/shared/tutorial/assets/Img_reverencia.png" id="5_lhn6w"] +[ext_resource type="Texture2D" uid="uid://d1j7603pam2ni" path="res://game/shared/tutorial/assets/Img_reverencia_key.png" id="5_wr8ki"] [ext_resource type="Texture2D" uid="uid://cxhuyyforfxwm" path="res://game/shared/tutorial/assets/Img_mindinho.png" id="6_go5ee"] +[ext_resource type="Texture2D" uid="uid://c5yrembbyndn1" path="res://game/shared/tutorial/assets/Img_mindinho_key.png" id="7_f5nm5"] [ext_resource type="Script" path="res://game/microgame_timer.gd" id="8_ygcq8"] +[ext_resource type="Texture2D" uid="uid://qf4u4kat18k7" path="res://game/shared/tutorial/assets/Img_maos_trocadas_mouse.png" id="9_unnor"] [ext_resource type="Texture2D" uid="uid://n0sv45rq3u1d" path="res://game/shared/timer/5.png" id="9_yhgor"] [ext_resource type="Texture2D" uid="uid://cfur1citqmkd1" path="res://game/shared/timer/4.png" id="10_v6xue"] [ext_resource type="Texture2D" uid="uid://bt58qlhtr7b4d" path="res://game/shared/timer/3.png" id="11_gpmug"] @@ -55,7 +58,7 @@ _data = { [sub_resource type="Resource" id="Resource_o6d01"] script = ExtResource("4_30kv1") texture_zoeira = ExtResource("5_lhn6w") -texture_instruction = ExtResource("5_lhn6w") +texture_instruction = ExtResource("5_wr8ki") type = 0 title = "Head on Keyboard" label_1 = "Touch any key with your forehead" @@ -64,7 +67,7 @@ label_2 = "LIke doing a reverence to your love" [sub_resource type="Resource" id="Resource_sjq73"] script = ExtResource("4_30kv1") texture_zoeira = ExtResource("6_go5ee") -texture_instruction = ExtResource("6_go5ee") +texture_instruction = ExtResource("7_f5nm5") type = 2 title = "Only pinky" label_1 = "Only press keys using your pinkies" @@ -73,7 +76,7 @@ label_2 = "To strenghten the bond between you and your love" [sub_resource type="Resource" id="Resource_40y54"] script = ExtResource("4_30kv1") texture_zoeira = ExtResource("4_xg44k") -texture_instruction = ExtResource("4_xg44k") +texture_instruction = ExtResource("9_unnor") type = 1 title = "Inverted Hand" label_1 = "Use the mouse with your non-dominant hand" @@ -218,9 +221,8 @@ _data = { "start": SubResource("Animation_4nygo") } -[sub_resource type="Animation" id="Animation_y56np"] -resource_name = "enter" -length = 0.5 +[sub_resource type="Animation" id="Animation_0006q"] +length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true @@ -228,14 +230,15 @@ tracks/0/path = NodePath(".:position") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0, 0.5), -"transitions": PackedFloat32Array(0.267943, 0.267943), +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), "update": 0, -"values": [Vector2(125, 722), Vector2(125, 547)] +"values": [Vector2(125, 722)] } -[sub_resource type="Animation" id="Animation_0006q"] -length = 0.001 +[sub_resource type="Animation" id="Animation_y56np"] +resource_name = "enter" +length = 0.5 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true @@ -243,10 +246,10 @@ tracks/0/path = NodePath(".:position") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(0.267943, 0.267943), "update": 0, -"values": [Vector2(125, 722)] +"values": [Vector2(125, 722), Vector2(125, 547)] } [sub_resource type="AnimationLibrary" id="AnimationLibrary_m05d7"] diff --git a/game/menu.gd b/game/menu.gd new file mode 100644 index 0000000..d35ab90 --- /dev/null +++ b/game/menu.gd @@ -0,0 +1,12 @@ +extends Control + + +func _ready(): + $Button.pressed.connect(_on_start_pressed, ConnectFlags.CONNECT_ONE_SHOT) + $AnimationPlayer.play("default") + + +func _on_start_pressed(): + $AnimationPlayer.play_backwards("default") + await $AnimationPlayer.animation_finished + get_tree().change_scene_to_file("res://game/main.tscn") diff --git a/game/menu.tscn b/game/menu.tscn new file mode 100644 index 0000000..f628774 --- /dev/null +++ b/game/menu.tscn @@ -0,0 +1,77 @@ +[gd_scene load_steps=5 format=3 uid="uid://bvjimat8d7liw"] + +[ext_resource type="Script" path="res://game/menu.gd" id="1_24jgf"] + +[sub_resource type="Animation" id="Animation_0210q"] +resource_name = "default" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Overlay:color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)] +} + +[sub_resource type="Animation" id="Animation_amao6"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Overlay:color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0, 0, 0, 1)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_n3va2"] +_data = { +"RESET": SubResource("Animation_amao6"), +"default": SubResource("Animation_0210q") +} + +[node name="Menu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_24jgf") + +[node name="Button" type="Button" parent="."] +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_left = 64.0 +offset_top = -165.0 +offset_right = 526.0 +offset_bottom = -69.0 +grow_vertical = 0 +theme_override_font_sizes/font_size = 64 +text = "Começar Jogo" + +[node name="Overlay" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +color = Color(0, 0, 0, 1) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_n3va2") +} diff --git a/game/shared/characters/character_animation.gd b/game/shared/characters/character_animation.gd index d3fdfc4..658cd9b 100644 --- a/game/shared/characters/character_animation.gd +++ b/game/shared/characters/character_animation.gd @@ -18,6 +18,12 @@ func _reset_animation(): animated_sprite.animation = "default" +func play_puff(): + $Explosion.show() + $Explosion.play("default") + $CharacterAnimatedSprite.hide() + + func play_happy(): animated_sprite.animation = "happy" var tween = create_tween() diff --git a/game/shared/characters/character_animation.tscn b/game/shared/characters/character_animation.tscn index 2dabd95..da65d30 100644 --- a/game/shared/characters/character_animation.tscn +++ b/game/shared/characters/character_animation.tscn @@ -1,7 +1,61 @@ -[gd_scene load_steps=3 format=3 uid="uid://k0mx61qjphst"] +[gd_scene load_steps=11 format=3 uid="uid://k0mx61qjphst"] [ext_resource type="Script" path="res://game/shared/characters/character_animation.gd" id="1_qpodi"] [ext_resource type="SpriteFrames" uid="uid://dbwmqcig0qbw8" path="res://game/shared/characters/ali_animation.tres" id="2_pffd0"] +[ext_resource type="Texture2D" uid="uid://btylon72bklla" path="res://game/shared/assets/explosion_sheet.png" id="3_ku7qd"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_mogqv"] +atlas = ExtResource("3_ku7qd") +region = Rect2(0, 0, 250, 250) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lkrct"] +atlas = ExtResource("3_ku7qd") +region = Rect2(250, 0, 250, 250) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j5rq3"] +atlas = ExtResource("3_ku7qd") +region = Rect2(500, 0, 250, 250) + +[sub_resource type="AtlasTexture" id="AtlasTexture_cexmg"] +atlas = ExtResource("3_ku7qd") +region = Rect2(0, 250, 250, 250) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gmwba"] +atlas = ExtResource("3_ku7qd") +region = Rect2(250, 250, 250, 250) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gb2np"] +atlas = ExtResource("3_ku7qd") +region = Rect2(500, 250, 250, 250) + +[sub_resource type="SpriteFrames" id="SpriteFrames_7dufu"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_mogqv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lkrct") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j5rq3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_cexmg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gmwba") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gb2np") +}, { +"duration": 1.0, +"texture": null +}], +"loop": false, +"name": &"default", +"speed": 15.0 +}] [node name="CharacterAnimation" type="Node2D"] script = ExtResource("1_qpodi") @@ -10,3 +64,8 @@ sprite_frames = ExtResource("2_pffd0") [node name="CharacterAnimatedSprite" type="AnimatedSprite2D" parent="."] unique_name_in_owner = true sprite_frames = ExtResource("2_pffd0") + +[node name="Explosion" type="AnimatedSprite2D" parent="."] +visible = false +scale = Vector2(1.408, 1.408) +sprite_frames = SubResource("SpriteFrames_7dufu") diff --git a/game/transition/transition.gd b/game/transition/transition.gd index 519d69f..62f8689 100644 --- a/game/transition/transition.gd +++ b/game/transition/transition.gd @@ -10,19 +10,31 @@ signal finished_animation var _lives = 0 var _characters = [] - +var _life = 0 func _ready() -> void: animation_player.speed_scale = speed_scale _characters = %Characters.get_children() +func lose_life(): + _characters[_life].play_puff() + _life += 1 + + func reset() -> void: animation_player.play("RESET") for c in _characters: c._reset_animation() +func show_instruction(instruction: InstructionResource): + %InstructionTexture.texture = instruction.texture_instruction + %InstructionLabel.text = instruction.title + animation_player.play("instruction") + await animation_player.animation_finished + + func microgame_fade_out(): animation_player.play("microgame_fade_out") await animation_player.animation_finished diff --git a/game/transition/transition.tscn b/game/transition/transition.tscn index d748f70..19ae8f7 100644 --- a/game/transition/transition.tscn +++ b/game/transition/transition.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=3 uid="uid://u3g8s4kck61t"] +[gd_scene load_steps=18 format=3 uid="uid://u3g8s4kck61t"] [ext_resource type="Script" path="res://game/transition/transition.gd" id="1_vtfth"] [ext_resource type="PackedScene" uid="uid://k0mx61qjphst" path="res://game/shared/characters/character_animation.tscn" id="2_2nft6"] @@ -7,12 +7,20 @@ [ext_resource type="Texture2D" uid="uid://6v31vl2mxbvb" path="res://game/shared/assets/namoradinha_sheet.png" id="4_wxw0m"] [ext_resource type="SpriteFrames" uid="uid://jvyw0cu710vo" path="res://game/shared/characters/kit_animation.tres" id="5_l50r6"] [ext_resource type="SpriteFrames" uid="uid://dwwhh2i13kfs2" path="res://game/shared/characters/mi_animation.tres" id="6_eiuh1"] +[ext_resource type="Texture2D" uid="uid://d1dtbc4srhlpl" path="res://game/shared/timer/Img_timer_1.png" id="8_m0riw"] +[ext_resource type="Texture2D" uid="uid://qf4u4kat18k7" path="res://game/shared/tutorial/assets/Img_maos_trocadas_mouse.png" id="9_6mo81"] [sub_resource type="LabelSettings" id="LabelSettings_wobn0"] font = ExtResource("2_phg5r") font_size = 80 font_color = Color(0, 0, 0, 1) +[sub_resource type="LabelSettings" id="LabelSettings_yb2o1"] +font = ExtResource("2_phg5r") +font_size = 48 +outline_size = 10 +outline_color = Color(0, 0, 0, 1) + [sub_resource type="Animation" id="Animation_gf6gi"] length = 0.001 tracks/0/type = "value" @@ -99,6 +107,18 @@ tracks/6/keys = { "update": 0, "values": [Vector2(982, 389)] } +tracks/7/type = "value" +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/path = NodePath("Foreground/InstructionTv:position") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(-444, 91)] +} [sub_resource type="Animation" id="Animation_67853"] resource_name = "microgame_fade_out" @@ -270,9 +290,26 @@ tracks/4/keys = { }] } +[sub_resource type="Animation" id="Animation_5h20a"] +resource_name = "instruction" +length = 1.6 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Foreground/InstructionTv:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.3, 1.3, 1.6), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(-444, 91), Vector2(382, 91), Vector2(382, 91), Vector2(1195, 91)] +} + [sub_resource type="AnimationLibrary" id="AnimationLibrary_en0c8"] _data = { "RESET": SubResource("Animation_gf6gi"), +"instruction": SubResource("Animation_5h20a"), "microgame_fade_out": SubResource("Animation_67853"), "show_microgame_count": SubResource("Animation_8isba"), "win_transition": SubResource("Animation_lm0of") @@ -342,10 +379,10 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = 5695.0 -offset_top = 2800.0 -offset_right = 5931.0 -offset_bottom = 2910.0 +offset_left = 7999.0 +offset_top = 4096.0 +offset_right = 8235.0 +offset_bottom = 4206.0 grow_horizontal = 2 grow_vertical = 2 text = "blabla" @@ -412,6 +449,35 @@ offset = Vector2(2.08165e-12, 2.08165e-12) hframes = 3 vframes = 5 +[node name="InstructionTv" type="TextureRect" parent="Foreground"] +offset_left = -444.0 +offset_top = 91.0 +offset_right = -47.0 +offset_bottom = 488.0 +texture = ExtResource("8_m0riw") + +[node name="InstructionTexture" type="TextureRect" parent="Foreground/InstructionTv"] +unique_name_in_owner = true +layout_mode = 0 +offset_left = 103.0 +offset_top = 125.0 +offset_right = 248.0 +offset_bottom = 270.0 +texture = ExtResource("9_6mo81") +expand_mode = 1 + +[node name="InstructionLabel" type="Label" parent="Foreground/InstructionTv"] +unique_name_in_owner = true +layout_mode = 0 +offset_left = -94.0 +offset_top = 349.0 +offset_right = 475.0 +offset_bottom = 398.0 +text = "Inverted Hand" +label_settings = SubResource("LabelSettings_yb2o1") +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="AnimationPlayer" type="AnimationPlayer" parent="."] unique_name_in_owner = true libraries = { |