Minor gameplay improvements

This commit is contained in:
bleeptrack 2020-11-25 15:21:10 +01:00
parent c863814862
commit 2d68e6fce1
7 changed files with 38 additions and 32 deletions

29
levels/2d/key Normal file
View file

@ -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!

View file

@ -56,20 +56,6 @@ func clear():
func substr2(s): func substr2(s):
return s.substr(2) 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(): func update():
if true:#grid: if true:#grid:

View file

@ -11,7 +11,6 @@
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
rect_min_size = Vector2( 0, 142 ) rect_min_size = Vector2( 0, 142 )
focus_mode = 2
theme = ExtResource( 3 ) theme = ExtResource( 3 )
script = ExtResource( 1 ) script = ExtResource( 1 )
__meta__ = { __meta__ = {

View file

@ -118,6 +118,6 @@ func dropped_on(other):
if other.type == "inventory": if other.type == "inventory":
file_browser.shell.run("take '%s'" % label) file_browser.shell.run("take '%s'" % label)
else: 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() file_browser.update()
other.update() other.update()

View file

@ -102,9 +102,6 @@ func construct():
var repo = repos[r] var repo = repos[r]
game.global_shell.cd(repo.path) game.global_shell.cd(repo.path)
game.global_shell.run(repo.setup_commands) 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(): func check_win():
var won = true var won = true

View file

@ -84,7 +84,7 @@ custom_constants/separation = 8
[node name="LevelInfo" type="VBoxContainer" parent="Rows/Columns/RightSide"] [node name="LevelInfo" type="VBoxContainer" parent="Rows/Columns/RightSide"]
margin_right = 633.0 margin_right = 633.0
margin_bottom = 255.0 margin_bottom = 306.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
custom_constants/separation = 8 custom_constants/separation = 8
@ -149,7 +149,7 @@ __meta__ = {
[node name="LevelPanel" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo"] [node name="LevelPanel" type="VBoxContainer" parent="Rows/Columns/RightSide/LevelInfo"]
margin_top = 47.0 margin_top = 47.0
margin_right = 633.0 margin_right = 633.0
margin_bottom = 255.0 margin_bottom = 306.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="LevelName" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"] [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"] [node name="Text" type="Control" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel"]
margin_right = 633.0 margin_right = 633.0
margin_bottom = 208.0 margin_bottom = 259.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/LevelInfo/LevelPanel/Text"] [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 )] [node name="FileBrowser" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )]
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 263.0 margin_top = 314.0
margin_right = 633.0 margin_right = 633.0
margin_bottom = 518.0 margin_bottom = 620.0
size_flags_vertical = 3 size_flags_vertical = 3
title = "Current environment" title = "Current environment"
[node name="Inventory" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )] [node name="Inventory" parent="Rows/Columns/RightSide" instance=ExtResource( 5 )]
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 526.0 margin_top = 628.0
margin_right = 633.0 margin_right = 633.0
margin_bottom = 782.0 margin_bottom = 782.0
size_flags_vertical = 3 size_flags_vertical = 3
size_flags_stretch_ratio = 0.5
title = "Current environment" title = "Current environment"
type = "inventory" type = "inventory"

View file

@ -32,12 +32,6 @@ func _ready():
history_position = game.state["history"].size() history_position = game.state["history"].size()
func _input(event): func _input(event):
if not $TextEditor.visible:
if event is InputEventKey:
var u = event.unicode
if u >= 97 && u <= 122:
input.grab_focus()
if not input.has_focus(): if not input.has_focus():
return return