From 0ba806108f1b833c49e8c4e6eaf7da5209a7f8d5 Mon Sep 17 00:00:00 2001 From: blinry Date: Wed, 18 Nov 2020 20:43:14 +0100 Subject: [PATCH] Rebuild lion level with 2D objects --- levels/2d/2d-test | 15 ------------- levels/2d/lion | 54 +++++++++++++++++++++++++++++++++++++++++++++++ scenes/item.gd | 4 +++- 3 files changed, 57 insertions(+), 16 deletions(-) delete mode 100644 levels/2d/2d-test create mode 100644 levels/2d/lion diff --git a/levels/2d/2d-test b/levels/2d/2d-test deleted file mode 100644 index d229d1f..0000000 --- a/levels/2d/2d-test +++ /dev/null @@ -1,15 +0,0 @@ -title = Apples -cards = checkout commit-auto reset-hard branch-delete - -[description] - -Testlevel for 2d interactive files. - -[setup] - -echo "x = 100 -y = 50" > apple -echo "x = 200 -y = 50" > pear -git add . -git commit -m "An apple a day" diff --git a/levels/2d/lion b/levels/2d/lion new file mode 100644 index 0000000..50f3866 --- /dev/null +++ b/levels/2d/lion @@ -0,0 +1,54 @@ +title = Parallelism +cards = checkout commit-auto + +[description] + +Did you know that creating parallel timelines is perfectly legal and safe? It's true! + +Can you find out when things went wrong in this zoo, and create a parallel universe where everyone is happy? + +[setup] + +echo "x = 500 +y = 100" > lion + +echo "x = 100 +y = 100" > child +git add . +git commit -m "The beginning" + +echo "x = 150 +y = 100" > lollipop +git add . +git commit -m "The child buys something" + +echo "x = 400 +y = 100" > child +git add . +git commit -m "The child climbs somewhere" + +git rm child +#echo "Looks happy. :)" > lion +git add . +git commit -m "Oh no" + +echo "x = 450 +y = 100" > lion +git add . +git commit -m "Nap time!" + +git checkout --detach +git branch -d main + +[win] + +# Is the child still there, and is the lion not hungry? +{ git ls-tree --name-only -r HEAD | grep child; } && { git show HEAD:lollipop | grep "x = 4"; } + +[congrats] + +Whew, good job! This seems like a *much* better outcome. + +Feel free to add more parallel timelines, or make them longer. + +If you're ready, our next mission is already waiting... diff --git a/scenes/item.gd b/scenes/item.gd index e3c32b5..da86a8a 100644 --- a/scenes/item.gd +++ b/scenes/item.gd @@ -34,9 +34,11 @@ func read_from_file(): "index": content = file_browser.shell.run("git show :'%s'" % label) modulate = Color(0, 0, 1.0) + $Sprite.scale = Vector2(0.75, 0.75) "head": content = file_browser.shell.run("git show HEAD:'%s'" % label) - modulate = Color(0, 0, 0, 0.5) + modulate = Color(0, 0, 0, 0.2) + $Sprite.scale = Vector2(0.8, 0.8) attributes = helpers.parse(content) position.x = int(attributes["x"])