diff --git a/levels/2d/key b/levels/2d/key new file mode 100644 index 0000000..924a3ce --- /dev/null +++ b/levels/2d/key @@ -0,0 +1,29 @@ +title = Find the key +cards = checkout commit-auto + +[description] + +Can you restore the key from the past to open the chest? +Put the key besides the chest and commit you changes to open the treasure! + +[setup] + +echo "x = 500 +y = 100" > chest + +echo "x = 100 +y = 100" > key +git add . +git commit -m "start" + +git rm key +git add . +git commit -m "key broke" + +[win] + +{ git ls-tree --name-only -r main | grep key; } && { git show main:key | grep "x = 4"; } + +[congrats] + +Whew, you're a treasure hunter now! diff --git a/scenes/file_browser.gd b/scenes/file_browser.gd index 5d4475f..b5be5d3 100644 --- a/scenes/file_browser.gd +++ b/scenes/file_browser.gd @@ -56,20 +56,6 @@ func clear(): func substr2(s): return s.substr(2) -func _process(delta): - if has_focus(): - var speed = 300*delta - var motion = Vector2(0, 0) - if Input.is_action_pressed("down"): - motion += Vector2(0,1) - if Input.is_action_pressed("up"): - motion += Vector2(0,-1) - if Input.is_action_pressed("right"): - motion += Vector2(1, 0) - if Input.is_action_pressed("left"): - motion += Vector2(-1, 0) - if motion.length() > 0: - player.move(motion.normalized()*speed) func update(): if true:#grid: diff --git a/scenes/file_browser.tscn b/scenes/file_browser.tscn index 1eb48d0..d7ee536 100644 --- a/scenes/file_browser.tscn +++ b/scenes/file_browser.tscn @@ -11,7 +11,6 @@ anchor_right = 1.0 anchor_bottom = 1.0 rect_min_size = Vector2( 0, 142 ) -focus_mode = 2 theme = ExtResource( 3 ) script = ExtResource( 1 ) __meta__ = { diff --git a/scenes/item.gd b/scenes/item.gd index 5b9872c..c0a806d 100644 --- a/scenes/item.gd +++ b/scenes/item.gd @@ -118,6 +118,6 @@ func dropped_on(other): if other.type == "inventory": file_browser.shell.run("take '%s'" % label) else: - other.shell.run("drop '%s' %d %d" % [label, rand_range(50, 400), rand_range(50, 200)]) + other.shell.run("drop '%s' %d %d" % [label, rand_range(50, other.rect_size.x - 50), rand_range(50, other.rect_size.y - 50)]) file_browser.update() other.update() diff --git a/scenes/level.gd b/scenes/level.gd index 22094d5..cd82866 100644 --- a/scenes/level.gd +++ b/scenes/level.gd @@ -102,9 +102,6 @@ func construct(): var repo = repos[r] game.global_shell.cd(repo.path) game.global_shell.run(repo.setup_commands) - # If there is no player, add one. - if game.global_shell.run("test -f you && echo yes || echo no") == "no\n": - game.global_shell.run("echo \"x = 200\ny = 200\" > you") func check_win(): var won = true diff --git a/scenes/main.tscn b/scenes/main.tscn index 84efa24..f589e9e 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -84,7 +84,7 @@ custom_constants/separation = 8 [node name="LevelInfo" type="VBoxContainer" parent="Rows/Columns/RightSide"] margin_right = 633.0 -margin_bottom = 255.0 +margin_bottom = 306.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_constants/separation = 8 @@ -149,7 +149,7 @@ __meta__ = { [node name="LevelPanel" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo"] margin_top = 47.0 margin_right = 633.0 -margin_bottom = 255.0 +margin_bottom = 306.0 size_flags_vertical = 3 [node name="LevelName" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"] @@ -165,7 +165,7 @@ __meta__ = { [node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"] margin_right = 633.0 -margin_bottom = 208.0 +margin_bottom = 259.0 size_flags_vertical = 3 [node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"] @@ -194,19 +194,20 @@ __meta__ = { [node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 263.0 +margin_top = 314.0 margin_right = 633.0 -margin_bottom = 518.0 +margin_bottom = 620.0 size_flags_vertical = 3 title = "Current environment" [node name="Inventory" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 526.0 +margin_top = 628.0 margin_right = 633.0 margin_bottom = 782.0 size_flags_vertical = 3 +size_flags_stretch_ratio = 0.5 title = "Current environment" type = "inventory" diff --git a/scenes/terminal.gd b/scenes/terminal.gd index 981c7d2..c6722fe 100644 --- a/scenes/terminal.gd +++ b/scenes/terminal.gd @@ -31,13 +31,7 @@ func _ready(): completions.hide() history_position = game.state["history"].size() -func _input(event): - if not $TextEditor.visible: - if event is InputEventKey: - var u = event.unicode - if u >= 97 && u <= 122: - input.grab_focus() - +func _input(event): if not input.has_focus(): return