summaryrefslogtreecommitdiff
path: root/components/Level.gd
diff options
context:
space:
mode:
authorJonas Bernard <public.jbernard@web.de>2021-04-25 22:55:56 +0200
committerJonas Bernard <public.jbernard@web.de>2021-04-25 22:55:56 +0200
commit29a0e70181cb7c2aa8f6e051138772965e678522 (patch)
tree5c5d091b99d133074741d8dc16bb45b4b83209e0 /components/Level.gd
parent7103016b8d0af10d3a9c0f0f4158b845cde09ba0 (diff)
downloadldjam48-29a0e70181cb7c2aa8f6e051138772965e678522.tar.gz
ldjam48-29a0e70181cb7c2aa8f6e051138772965e678522.tar.bz2
ldjam48-29a0e70181cb7c2aa8f6e051138772965e678522.zip
Password level 1
Diffstat (limited to 'components/Level.gd')
-rw-r--r--components/Level.gd33
1 files changed, 33 insertions, 0 deletions
diff --git a/components/Level.gd b/components/Level.gd
index f9688a9..72366e1 100644
--- a/components/Level.gd
+++ b/components/Level.gd
@@ -4,6 +4,9 @@ class_name Level
signal lost_heart()
signal level_finished()
+onready var passwordfield = $password
+var trys = 0
+
func start():
print("Level starting.")
@@ -13,3 +16,33 @@ func lose_heart():
func finish_level():
emit_signal("level_finished")
+
+func login():
+ $Incorrect.visible = false
+ get_tree().change_scene("res://scenes/introduction/mail.tscn")
+ finish_level()
+
+func check_pw():
+ if passwordfield.text == "correct":
+ login()
+ else:
+ if passwordfield.text == "deeper" or trys == 10:
+ $Monolog2.start()
+ $Monolog1.visible = false
+ if trys == 20:
+ $Monolog3.start()
+ $Monolog2.visible = false
+ trys = trys + 1
+ $Incorrect.visible = true
+ passwordfield.text = ""
+
+func _on_Button_on_click():
+ check_pw()
+
+
+func _on_password_text_changed(new_text):
+ $Incorrect.visible = false
+
+
+func _on_password_text_entered(new_text):
+ check_pw()