summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/textrevealbox.gd8
-rw-r--r--components/textrevealbox.tscn1
-rw-r--r--scenes/levels/base_level.gd1
-rw-r--r--scenes/levels/base_level.tscn1
-rw-r--r--scenes/levels/typeracer.gd36
-rw-r--r--scenes/levels/typeracer.tscn57
-rw-r--r--scenes/levels/typeracer_explain.gd9
-rw-r--r--scenes/levels/typeracer_explain.tscn20
-rw-r--r--scenes/menu.tscn1
9 files changed, 125 insertions, 9 deletions
diff --git a/components/textrevealbox.gd b/components/textrevealbox.gd
index 175ac92..be71213 100644
--- a/components/textrevealbox.gd
+++ b/components/textrevealbox.gd
@@ -2,11 +2,19 @@ extends Node2D
export(String, MULTILINE) var text = "Failed to load text :("
export var autostart = true
+export var speed = 10
+
+signal finished_reveal()
func _ready():
$TextReveal.to_render = text
+ $TextReveal.speed = speed
if autostart:
$TextReveal.start()
func start():
$TextReveal.start()
+
+
+func _on_TextReveal_finished_reveal():
+ emit_signal("finished_reveal")
diff --git a/components/textrevealbox.tscn b/components/textrevealbox.tscn
index 386ede7..79c1cee 100644
--- a/components/textrevealbox.tscn
+++ b/components/textrevealbox.tscn
@@ -15,3 +15,4 @@ script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
+[connection signal="finished_reveal" from="TextReveal" to="." method="_on_TextReveal_finished_reveal"]
diff --git a/scenes/levels/base_level.gd b/scenes/levels/base_level.gd
index f712ba7..8f06747 100644
--- a/scenes/levels/base_level.gd
+++ b/scenes/levels/base_level.gd
@@ -7,6 +7,7 @@ onready var _path_renderer : PathRenderer = $PathRenderer
onready var _health_bar = $Camera2D/healthbar
onready var _last_camera_location : Vector2 = $Camera2D.position
const _levels = [
+ preload("res://scenes/levels/typeracer_explain.tscn"),
preload("res://scenes/levels/typeracer.tscn"),
preload("res://scenes/levels/reactiontest.tscn")
]
diff --git a/scenes/levels/base_level.tscn b/scenes/levels/base_level.tscn
index e2d57ba..6681a7d 100644
--- a/scenes/levels/base_level.tscn
+++ b/scenes/levels/base_level.tscn
@@ -41,7 +41,6 @@ position = Vector2( 571.642, -311.599 )
text = "Menu"
[node name="PauseMenu" parent="Camera2D" instance=ExtResource( 5 )]
-
[connection signal="done" from="Camera2D" to="." method="_on_Camera2D_done"]
[connection signal="on_click" from="Camera2D/MenuButton" to="." method="_on_MenuButton_on_click"]
[connection signal="unpause" from="Camera2D/PauseMenu" to="." method="_on_PauseMenu_unpause"]
diff --git a/scenes/levels/typeracer.gd b/scenes/levels/typeracer.gd
index 536e35a..d461e60 100644
--- a/scenes/levels/typeracer.gd
+++ b/scenes/levels/typeracer.gd
@@ -1,6 +1,38 @@
extends Level
+onready var timer_label = $TimeLabel
+
+var timer = 0
+var total = 0
+var running = false
+
func start():
.start()
- finish_level() # fix your stuff
- pass
+ total = _total_time()
+ running = true
+ $Incorrect.visible = false
+
+
+func _total_time():
+ if Settings.difficulty == Settings.Difficulty.HARD:
+ return 10
+ return 20
+
+func _process(delta):
+ if running:
+ timer += delta
+ timer_label.text = str(total - timer)
+ if timer >= total:
+ eval()
+
+func eval():
+ if $Label.text == $TextEdit.text:
+ finish_level()
+ else:
+ lose_heart()
+ timer = 0
+ $TextEdit.text = ""
+ $Incorrect.visible = true
+
+func _on_Button_on_click():
+ eval()
diff --git a/scenes/levels/typeracer.tscn b/scenes/levels/typeracer.tscn
index ed3aa50..3d2aad7 100644
--- a/scenes/levels/typeracer.tscn
+++ b/scenes/levels/typeracer.tscn
@@ -1,15 +1,62 @@
-[gd_scene load_steps=2 format=2]
+[gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/levels/typeracer.gd" type="Script" id=1]
+[ext_resource path="res://textures/colors/light_blue.png" type="Texture" id=2]
+[ext_resource path="res://components/button.tscn" type="PackedScene" id=3]
[node name="Node2D" type="Node2D"]
script = ExtResource( 1 )
+[node name="Sprite" type="Sprite" parent="."]
+position = Vector2( -0.109284, 2.36197 )
+scale = Vector2( 950.266, 537.001 )
+texture = ExtResource( 2 )
+
[node name="TextEdit" type="TextEdit" parent="."]
-margin_left = -374.585
-margin_top = -112.886
-margin_right = 385.416
-margin_bottom = 113.114
+margin_left = -301.579
+margin_top = -0.914124
+margin_right = 305.421
+margin_bottom = 225.086
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Label" type="Label" parent="."]
+margin_left = -302.51
+margin_top = -228.588
+margin_right = 315.49
+margin_bottom = -21.5884
+text = "Hey Matt,
+
+yes I'm on my way as soon as possible.
+See you,
+
+Tom"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="TimeLabel" type="Label" parent="."]
+margin_left = -463.0
+margin_top = -255.0
+margin_right = -291.0
+margin_bottom = -209.0
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Button" parent="." instance=ExtResource( 3 )]
+position = Vector2( 387.398, 195.318 )
+text = "Send"
+
+[node name="Incorrect" type="Label" parent="."]
+visible = false
+margin_left = -308.457
+margin_top = 231.335
+margin_right = 317.543
+margin_bottom = 266.335
+text = "The text you wrote is not exactely correct"
__meta__ = {
"_edit_use_anchors_": false
}
+[connection signal="on_click" from="Button" to="." method="_on_Button_on_click"]
diff --git a/scenes/levels/typeracer_explain.gd b/scenes/levels/typeracer_explain.gd
new file mode 100644
index 0000000..18624e4
--- /dev/null
+++ b/scenes/levels/typeracer_explain.gd
@@ -0,0 +1,9 @@
+extends Level
+
+func start():
+ .start()
+ $TextrevealBox.start()
+
+
+func _on_TextrevealBox_finished_reveal():
+ finish_level()
diff --git a/scenes/levels/typeracer_explain.tscn b/scenes/levels/typeracer_explain.tscn
new file mode 100644
index 0000000..f4b8897
--- /dev/null
+++ b/scenes/levels/typeracer_explain.tscn
@@ -0,0 +1,20 @@
+[gd_scene load_steps=4 format=2]
+
+[ext_resource path="res://components/textrevealbox.tscn" type="PackedScene" id=1]
+[ext_resource path="res://scenes/levels/typeracer_explain.gd" type="Script" id=2]
+[ext_resource path="res://textures/colors/light_blue.png" type="Texture" id=3]
+
+[node name="Node2D" type="Node2D"]
+position = Vector2( 1.33484, 0 )
+script = ExtResource( 2 )
+
+[node name="Sprite" type="Sprite" parent="."]
+position = Vector2( 5.72205e-06, 0.667416 )
+scale = Vector2( 671.09, 199.891 )
+texture = ExtResource( 3 )
+
+[node name="TextrevealBox" parent="." instance=ExtResource( 1 )]
+text = "Now type the answer of the mail in time!"
+autostart = false
+speed = 8
+[connection signal="finished_reveal" from="TextrevealBox" to="." method="_on_TextrevealBox_finished_reveal"]
diff --git a/scenes/menu.tscn b/scenes/menu.tscn
index 3828ad6..48707b6 100644
--- a/scenes/menu.tscn
+++ b/scenes/menu.tscn
@@ -194,7 +194,6 @@ anims/startgame = SubResource( 2 )
[node name="Outgoing" type="AnimationPlayer" parent="."]
anims/tointro = SubResource( 3 )
anims/tosettings = SubResource( 4 )
-
[connection signal="on_click" from="Content/Back" to="." method="_on_Back_on_click"]
[connection signal="on_click" from="Content/HardMode" to="." method="_on_HardMode_on_click"]
[connection signal="on_click" from="Content/Exit" to="." method="_on_Exit_on_click"]