summaryrefslogtreecommitdiff
path: root/components
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
parent7103016b8d0af10d3a9c0f0f4158b845cde09ba0 (diff)
downloadldjam48-29a0e70181cb7c2aa8f6e051138772965e678522.tar.gz
ldjam48-29a0e70181cb7c2aa8f6e051138772965e678522.tar.bz2
ldjam48-29a0e70181cb7c2aa8f6e051138772965e678522.zip
Password level 1
Diffstat (limited to 'components')
-rw-r--r--components/Level.gd33
-rw-r--r--components/textreveal.gd8
-rw-r--r--components/textrevealbox.gd12
-rw-r--r--components/textrevealbox.tscn17
4 files changed, 68 insertions, 2 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()
diff --git a/components/textreveal.gd b/components/textreveal.gd
index e1fa4cc..7b96eb3 100644
--- a/components/textreveal.gd
+++ b/components/textreveal.gd
@@ -4,7 +4,10 @@ class_name TextReveal
signal finished_reveal()
export(String, MULTILINE) var to_render = "Text"
-export var speed = 100.0
+export var speed = 20.0
+
+export var xpos = 0
+export var ypos = 0
############
# INTERNAL #
@@ -19,6 +22,7 @@ var t = 0
# Called when the node enters the scene tree for the first time.
func _ready():
theme = preload("res://fonts/Flipps_Theme.tres")
+ rect_position = Vector2(xpos, ypos)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
@@ -29,7 +33,7 @@ func _process(delta):
t -= additional
revealed += additional
text = to_render.substr(0, revealed)
- rect_position = -rect_size / 2
+ rect_position = -rect_size / 2 + Vector2(xpos, ypos)
if to_render.length() <= revealed:
started = false
finished = true
diff --git a/components/textrevealbox.gd b/components/textrevealbox.gd
new file mode 100644
index 0000000..175ac92
--- /dev/null
+++ b/components/textrevealbox.gd
@@ -0,0 +1,12 @@
+extends Node2D
+
+export(String, MULTILINE) var text = "Failed to load text :("
+export var autostart = true
+
+func _ready():
+ $TextReveal.to_render = text
+ if autostart:
+ $TextReveal.start()
+
+func start():
+ $TextReveal.start()
diff --git a/components/textrevealbox.tscn b/components/textrevealbox.tscn
new file mode 100644
index 0000000..386ede7
--- /dev/null
+++ b/components/textrevealbox.tscn
@@ -0,0 +1,17 @@
+[gd_scene load_steps=3 format=2]
+
+[ext_resource path="res://components/textreveal.gd" type="Script" id=1]
+[ext_resource path="res://components/textrevealbox.gd" type="Script" id=2]
+
+[node name="TextrevealBox" type="Node2D"]
+script = ExtResource( 2 )
+
+[node name="TextReveal" type="Label" parent="."]
+margin_left = -54.0
+margin_top = -28.0
+margin_right = 56.0
+margin_bottom = 21.0
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}