diff options
author | Henrique Alves <henriquelalves@gmail.com> | 2022-07-17 04:24:00 -0300 |
---|---|---|
committer | Henrique Alves <henriquelalves@gmail.com> | 2022-07-17 04:24:00 -0300 |
commit | 5b55438f5805d18bba0b5b773e3af3a2fd3858ea (patch) | |
tree | 00f0cf15c30358c69d55bc4b1d62e8636b90842e | |
parent | 2babce369e4fdfc96328da97d48dd238381cb2e6 (diff) | |
download | gamejam-gmtk-2022-5b55438f5805d18bba0b5b773e3af3a2fd3858ea.tar.gz gamejam-gmtk-2022-5b55438f5805d18bba0b5b773e3af3a2fd3858ea.tar.bz2 gamejam-gmtk-2022-5b55438f5805d18bba0b5b773e3af3a2fd3858ea.zip |
onboarding
-rw-r--r-- | Scenes/Builder.gd | 22 | ||||
-rw-r--r-- | Scenes/Dungeon.gd | 5 | ||||
-rw-r--r-- | Scenes/Dungeon.tscn | 415 | ||||
-rw-r--r-- | Scenes/Global.gd | 1 | ||||
-rw-r--r-- | Scenes/UIController.gd | 51 |
5 files changed, 483 insertions, 11 deletions
diff --git a/Scenes/Builder.gd b/Scenes/Builder.gd index 8413e6e..8e82351 100644 --- a/Scenes/Builder.gd +++ b/Scenes/Builder.gd @@ -246,16 +246,18 @@ func choose_divider() -> int: func build_layout(corner : Vector2, crystals : int, current_stage : int, dungeon): var phi = 0 - match randi() % 4: - 1: - corner += Vector2(room_size - 1, 0) - phi = PI / 2 - 2: - corner += Vector2(room_size - 1, room_size - 1) - phi = PI - 3: - corner += Vector2(0, room_size - 1) - phi = PI * 3 / 2 + + if Global.current_stage != 0: + match randi() % 4: + 1: + corner += Vector2(room_size - 1, 0) + phi = PI / 2 + 2: + corner += Vector2(room_size - 1, room_size - 1) + phi = PI + 3: + corner += Vector2(0, room_size - 1) + phi = PI * 3 / 2 var space = Space.new(corner, phi, dungeon) match choose_layout(current_stage): diff --git a/Scenes/Dungeon.gd b/Scenes/Dungeon.gd index ae758ce..556134e 100644 --- a/Scenes/Dungeon.gd +++ b/Scenes/Dungeon.gd @@ -35,6 +35,11 @@ func intro_animation(): $UIController.hand_animation() yield(get_tree().create_timer(1.1), "timeout") player.show() + + if Global.onboarding: + yield($UIController.on_onboarding(), "completed") + Global.onboarding = false + block_input = false func end_animation(): diff --git a/Scenes/Dungeon.tscn b/Scenes/Dungeon.tscn index 072dc0f..bc864b0 100644 --- a/Scenes/Dungeon.tscn +++ b/Scenes/Dungeon.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=27 format=2] [ext_resource path="res://Scenes/Dungeon.gd" type="Script" id=1] [ext_resource path="res://Scenes/CameraControl.gd" type="Script" id=2] @@ -28,6 +28,223 @@ outline_size = 2 outline_color = Color( 0, 0, 0, 1 ) font_data = ExtResource( 5 ) +[sub_resource type="Animation" id=11] +resource_name = "FadeIn" +length = 0.4 +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 ) ] +} + +[sub_resource type="Animation" id=12] +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 ) ] +} + +[sub_resource type="Animation" id=13] +resource_name = "FadeIn" +length = 0.4 +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 ) ] +} + +[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 ) ] +} + +[sub_resource type="Animation" id=15] +resource_name = "FadeIn" +length = 0.4 +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 ) ] +} + +[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 ) ] +} + +[sub_resource type="Animation" id=17] +resource_name = "FadeIn" +length = 0.4 +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 ) ] +} + +[sub_resource type="Animation" id=18] +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 ) ] +} + +[sub_resource type="Animation" id=19] +resource_name = "FadeIn" +length = 0.4 +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 ) ] +} + +[sub_resource type="Animation" id=20] +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 ) ] +} + +[sub_resource type="Animation" id=21] +resource_name = "FadeIn" +length = 0.4 +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 ) ] +} + +[sub_resource type="Animation" id=22] +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 ) ] +} + +[sub_resource type="Animation" id=9] +resource_name = "FadeIn" +length = 0.4 +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 ) ] +} + +[sub_resource type="Animation" id=10] +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 ) ] +} + [sub_resource type="Animation" id=7] resource_name = "HandMoving" length = 3.0 @@ -135,6 +352,202 @@ rect_rotation = -87.8432 texture = ExtResource( 7 ) expand = true +[node name="OnboardingOverlay" type="ColorRect" parent="UIController"] +modulate = Color( 1, 1, 1, 0 ) +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 0.368627 ) + +[node name="Intro1" type="Label" parent="UIController/OnboardingOverlay"] +visible = false +modulate = Color( 1, 1, 1, 0 ) +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -1011.0 +margin_top = 101.0 +margin_right = -645.0 +margin_bottom = 178.0 +custom_fonts/font = SubResource( 6 ) +text = "This is how many turns you have left to complete the stage!" +valign = 2 +autowrap = true + +[node name="Up" type="Label" parent="UIController/OnboardingOverlay/Intro1"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -192.0 +margin_top = -25.0 +margin_right = -175.0 +margin_bottom = 12.0 +rect_rotation = 89.7773 +custom_fonts/font = SubResource( 6 ) +text = "<" +align = 1 +valign = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="UIController/OnboardingOverlay/Intro1"] +anims/FadeIn = SubResource( 11 ) +anims/RESET = SubResource( 12 ) + +[node name="Intro2" type="Label" parent="UIController/OnboardingOverlay"] +visible = false +modulate = Color( 1, 1, 1, 0 ) +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -1011.0 +margin_top = 101.0 +margin_right = -645.0 +margin_bottom = 178.0 +custom_fonts/font = SubResource( 6 ) +text = "They accumulate each stage, so be careful using them!" +valign = 2 +autowrap = true + +[node name="Up" type="Label" parent="UIController/OnboardingOverlay/Intro2"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -192.0 +margin_top = -25.0 +margin_right = -175.0 +margin_bottom = 12.0 +rect_rotation = 89.7773 +custom_fonts/font = SubResource( 6 ) +text = "<" +align = 1 +valign = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="UIController/OnboardingOverlay/Intro2"] +anims/FadeIn = SubResource( 13 ) +anims/RESET = SubResource( 14 ) + +[node name="Intro3" type="Label" parent="UIController/OnboardingOverlay"] +visible = false +modulate = Color( 1, 1, 1, 0 ) +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -585.0 +margin_top = 56.0 +margin_right = -219.0 +margin_bottom = 173.0 +custom_fonts/font = SubResource( 6 ) +text = "This is a monster! Step on them to gain turns!" +valign = 2 +autowrap = true + +[node name="Up" type="Label" parent="UIController/OnboardingOverlay/Intro3"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -231.0 +margin_top = 141.0 +margin_right = -214.0 +margin_bottom = 178.0 +rect_rotation = -89.269 +custom_fonts/font = SubResource( 6 ) +text = "<" +align = 1 +valign = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="UIController/OnboardingOverlay/Intro3"] +anims/FadeIn = SubResource( 15 ) +anims/RESET = SubResource( 16 ) + +[node name="Intro4" type="Label" parent="UIController/OnboardingOverlay"] +visible = false +modulate = Color( 1, 1, 1, 0 ) +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -648.0 +margin_top = 57.0 +margin_right = -219.0 +margin_bottom = 174.0 +custom_fonts/font = SubResource( 6 ) +text = "You'll win more turns depending on the dice face when you step on them!" +valign = 2 +autowrap = true + +[node name="Up" type="Label" parent="UIController/OnboardingOverlay/Intro4"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -231.0 +margin_top = 141.0 +margin_right = -214.0 +margin_bottom = 178.0 +rect_rotation = -89.269 +custom_fonts/font = SubResource( 6 ) +text = "<" +align = 1 +valign = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="UIController/OnboardingOverlay/Intro4"] +anims/FadeIn = SubResource( 17 ) +anims/RESET = SubResource( 18 ) + +[node name="Intro5" type="Label" parent="UIController/OnboardingOverlay"] +visible = false +modulate = Color( 1, 1, 1, 0 ) +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -517.0 +margin_top = 253.0 +margin_right = -88.0 +margin_bottom = 370.0 +custom_fonts/font = SubResource( 6 ) +text = "Win the stage by activating the crystals!" +valign = 2 +autowrap = true + +[node name="Up" type="Label" parent="UIController/OnboardingOverlay/Intro5"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -244.0 +margin_top = 14.0 +margin_right = -227.0 +margin_bottom = 51.0 +rect_rotation = 88.8921 +custom_fonts/font = SubResource( 6 ) +text = "<" +align = 1 +valign = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="UIController/OnboardingOverlay/Intro5"] +anims/FadeIn = SubResource( 19 ) +anims/RESET = SubResource( 20 ) + +[node name="Intro6" type="Label" parent="UIController/OnboardingOverlay"] +visible = false +modulate = Color( 1, 1, 1, 0 ) +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -554.0 +margin_top = 299.0 +margin_right = -125.0 +margin_bottom = 416.0 +custom_fonts/font = SubResource( 6 ) +text = "You can only activate the crystal with a value of 1, 2 or 3 on the dice!" +valign = 2 +autowrap = true + +[node name="Up" type="Label" parent="UIController/OnboardingOverlay/Intro6"] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -206.0 +margin_top = -30.0 +margin_right = -189.0 +margin_bottom = 7.0 +rect_rotation = 90.0938 +custom_fonts/font = SubResource( 6 ) +text = "<" +align = 1 +valign = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="UIController/OnboardingOverlay/Intro6"] +anims/FadeIn = SubResource( 21 ) +anims/RESET = SubResource( 22 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="UIController/OnboardingOverlay"] +anims/FadeIn = SubResource( 9 ) +anims/RESET = SubResource( 10 ) + [node name="AnimationPlayer" type="AnimationPlayer" parent="UIController"] anims/HandMoving = SubResource( 7 ) anims/RESET = SubResource( 8 ) diff --git a/Scenes/Global.gd b/Scenes/Global.gd index 84717d1..1bda622 100644 --- a/Scenes/Global.gd +++ b/Scenes/Global.gd @@ -7,6 +7,7 @@ onready var turns = STARTING_TURNS setget set_turns onready var current_stage = 0 setget set_stage onready var active_crystals = 0 setget set_crystals onready var max_crystals = 0 +onready var onboarding = true signal update_ui diff --git a/Scenes/UIController.gd b/Scenes/UIController.gd index aeb44ed..99e85c6 100644 --- a/Scenes/UIController.gd +++ b/Scenes/UIController.gd @@ -6,6 +6,8 @@ onready var particles = $Particles onready var activated_crystals +signal _skip_step + func _ready(): Global.connect("update_ui", self, "_on_update_ui") yield(get_tree(),"idle_frame") @@ -24,3 +26,52 @@ func on_monster_killed(monster_pos, score): func hand_animation(): $AnimationPlayer.play("HandMoving") + +func on_onboarding(): +# var monster_2d = main_camera.unproject_position(monster_pos) +# var crystal_2d = main_camera.unproject_position(crystal_pos) +# +# var monster_offset = Vector2(-100,100) +# var crystal_offset = Vector2(-100,100) +# +# $OnboardingOverlay/Intro3.rect_position = monster_2d + monster_offset +# $OnboardingOverlay/Intro4.rect_position = monster_2d + monster_offset +# $OnboardingOverlay/Intro5.rect_position = crystal_2d + crystal_offset +# $OnboardingOverlay/Intro6.rect_position = crystal_2d + crystal_offset + + $OnboardingOverlay.show() + $OnboardingOverlay/AnimationPlayer.play("FadeIn") + yield($OnboardingOverlay/AnimationPlayer,"animation_finished") + yield(onboarding_step(1), "completed") + yield(onboarding_step(2), "completed") + yield(onboarding_step(3), "completed") + yield(onboarding_step(4), "completed") + yield(onboarding_step(5), "completed") + yield(onboarding_step(6), "completed") + $OnboardingOverlay/AnimationPlayer.play_backwards("FadeIn") + yield($OnboardingOverlay/AnimationPlayer,"animation_finished") + $OnboardingOverlay.hide() + +func _input(event): + if event is InputEventKey and event.is_pressed(): + emit_signal("_skip_step") + + +func onboarding_step(i): + var intro = get_node("OnboardingOverlay/Intro%d" % i) + intro.show() + var intro_player = intro.get_node("AnimationPlayer") + intro_player.play("FadeIn") + yield(intro_player, "animation_finished") + + var timer = get_tree().create_timer(4) + timer.connect("timeout", self, "emit_signal", ["_skip_step"]) + + yield(self, "_skip_step") + + if timer != null: + timer.disconnect("timeout", self, "emit_signal") + + intro_player.play_backwards("FadeIn") + yield(intro_player, "animation_finished") + intro.hide() |