summaryrefslogtreecommitdiff
path: root/scenes/levels/typeracer.gd
diff options
context:
space:
mode:
authorJonas Bernard <public.jbernard@web.de>2021-04-27 02:07:21 +0200
committerJonas Bernard <public.jbernard@web.de>2021-04-27 02:07:21 +0200
commit8755544fd0dbb801f8d593f5891eaee00dd4ecd5 (patch)
treedc428c56d6eeea74efd5e71a53e7908c36fbb64d /scenes/levels/typeracer.gd
parent993cf633979d8e96ad5eb051e44ab3a4a2ceccfa (diff)
downloadldjam48-8755544fd0dbb801f8d593f5891eaee00dd4ecd5.tar.gz
ldjam48-8755544fd0dbb801f8d593f5891eaee00dd4ecd5.tar.bz2
ldjam48-8755544fd0dbb801f8d593f5891eaee00dd4ecd5.zip
Level
Diffstat (limited to 'scenes/levels/typeracer.gd')
-rw-r--r--scenes/levels/typeracer.gd8
1 files changed, 7 insertions, 1 deletions
diff --git a/scenes/levels/typeracer.gd b/scenes/levels/typeracer.gd
index 35225be..e91e360 100644
--- a/scenes/levels/typeracer.gd
+++ b/scenes/levels/typeracer.gd
@@ -5,6 +5,8 @@ onready var timer_label = $TimeLabel
var timer = 0
var total = 0
+var started = false
+
func start():
.start()
total = _total_time()
@@ -20,13 +22,15 @@ func _total_time():
func _process(delta):
if not running:
return
+ if not started:
+ return
timer += delta
timer_label.text = str(total - timer)
if timer >= total:
eval()
func eval():
- if $Label.text.replace('\r\n', '\n').replace('\r', '\n') == $TextEdit.text.replace('\r\n', '\n').replace('\r', '\n'):
+ if $Label.text.replace('\r\n', '').replace('\r', '').replace(' ', '') == $TextEdit.text.replace('\r\n', '').replace('\r', '').replace(' ', ''):
$TextEdit.readonly = true
$Button.disabled = true
$Incorrect.visible = false
@@ -49,4 +53,6 @@ func _on_Button_on_click():
func _on_TextEdit_text_changed():
+ if not started:
+ started = true
eval_corr()