diff options
author | Jonas Bernard <public.jbernard@web.de> | 2021-04-26 17:47:08 +0200 |
---|---|---|
committer | Jonas Bernard <public.jbernard@web.de> | 2021-04-26 17:47:08 +0200 |
commit | b1e4f45c85d3c67ec35c395c23f916d71e4c14db (patch) | |
tree | 7b8711ff4e463107e0aa0c038a9237208c7c722e /scenes/levels | |
parent | 670c575ee920b730578f2a3eb78c13c08771fe19 (diff) | |
download | ldjam48-b1e4f45c85d3c67ec35c395c23f916d71e4c14db.tar.gz ldjam48-b1e4f45c85d3c67ec35c395c23f916d71e4c14db.tar.bz2 ldjam48-b1e4f45c85d3c67ec35c395c23f916d71e4c14db.zip |
Typeracer Teil 1
Diffstat (limited to 'scenes/levels')
-rw-r--r-- | scenes/levels/base_level.gd | 1 | ||||
-rw-r--r-- | scenes/levels/base_level.tscn | 1 | ||||
-rw-r--r-- | scenes/levels/typeracer.gd | 36 | ||||
-rw-r--r-- | scenes/levels/typeracer.tscn | 57 | ||||
-rw-r--r-- | scenes/levels/typeracer_explain.gd | 9 | ||||
-rw-r--r-- | scenes/levels/typeracer_explain.tscn | 20 |
6 files changed, 116 insertions, 8 deletions
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"] |