From 21f55fd7050ff5931d4f11bf476cbb3ec0f97710 Mon Sep 17 00:00:00 2001 From: blinry Date: Thu, 18 Feb 2021 16:03:46 +0100 Subject: [PATCH 1/2] Insert a level in the intro that forces players to use the command line --- levels/index/new | 4 ++++ levels/intro/cli | 29 +++++++++++++++++++++++++++++ levels/intro/init | 6 +----- levels/intro/remote | 2 ++ levels/intro/sequence | 1 + levels/workflows/sequence | 1 - 6 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 levels/intro/cli diff --git a/levels/index/new b/levels/index/new index 5c86afa..4df3930 100644 --- a/levels/index/new +++ b/levels/index/new @@ -11,6 +11,10 @@ To learn how that works, we need to learn about the "index"! In the index, we ca Initially, the index is empty. To make a commit that contains a new file, we need to add it! +[cli] + +You can use tab completion in the terminal! Start typing a filename, then press the tab key to complete its name. This will often save you some time! + [setup] echo "The candle is burning with a blue flame." > candle diff --git a/levels/intro/cli b/levels/intro/cli new file mode 100644 index 0000000..de2380b --- /dev/null +++ b/levels/intro/cli @@ -0,0 +1,29 @@ +title = The command line +cards = + +[description] + +These playing cards are designed to be easy to use and to remember! We'd suggest sticking to them if you don't have a lot of experience with Git! + +[cli] + +But there's another way to interact with Git: + +Try typing `git init` into the black terminal below, and pressing the enter key! + +[setup] + +rm -rf .git + +[win] + +# Initialize the time machine! +test -d .git + +[congrats] + +Cool! When you don't use the cards in a level, you'll get a golden sparkling "command line badge"! See it in the top left? + +The command line is pretty powerful! Often, you can use it to solve tasks faster compared to using a graphical interface. + +It's also totally optional in this game. But if you want to learn how to use Git from the command line, we invite you to this challenge! :) diff --git a/levels/intro/init b/levels/intro/init index 7c76983..ea0426e 100644 --- a/levels/intro/init +++ b/levels/intro/init @@ -7,11 +7,7 @@ You've been accepted to time travel school! Yay! It's your first day! Your teach "To do anything with a time machine, you first need to initialize it!" -Drag the blue card up to play it! - -[cli] - -Instead of using the card, you can also type `git init` into the black box below, and press the enter key! +Drag that blue card up to play it! [setup] diff --git a/levels/intro/remote b/levels/intro/remote index c3c5e99..a493fba 100644 --- a/levels/intro/remote +++ b/levels/intro/remote @@ -15,6 +15,8 @@ To clone the teacher's repo via the command line, you need this command: (Don't forget the dot at the end!) +To go through old commands, you can press arrow up and down. That way, you don't have to type in long commands twice. + [congrats] Welcome to time travel school! :) I'll see you for your first class tomorrow! diff --git a/levels/intro/sequence b/levels/intro/sequence index 82ef53c..aa225df 100644 --- a/levels/intro/sequence +++ b/levels/intro/sequence @@ -1,5 +1,6 @@ risky copies init +cli commit remote diff --git a/levels/workflows/sequence b/levels/workflows/sequence index d2bb0d4..1be11a8 100644 --- a/levels/workflows/sequence +++ b/levels/workflows/sequence @@ -1,2 +1 @@ pr -gitignore From 94462e9123e19e02991569417c08cde657a313b8 Mon Sep 17 00:00:00 2001 From: blinry Date: Thu, 18 Feb 2021 16:44:04 +0100 Subject: [PATCH 2/2] Show the current state of the badge in a level, instead of the future one --- scenes/cli_badge.gd | 9 +++++++-- scenes/cli_badge.tscn | 8 ++++++++ scenes/main.gd | 12 ++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/scenes/cli_badge.gd b/scenes/cli_badge.gd index 4884444..675d58f 100644 --- a/scenes/cli_badge.gd +++ b/scenes/cli_badge.gd @@ -2,6 +2,7 @@ extends TextureRect export var active = true setget _set_active export var sparkling = true setget _set_sparkling +export var impossible = false setget _set_impossible func _ready(): @@ -10,12 +11,16 @@ func _ready(): func _set_active(new_active): active = new_active if active: - self.modulate = Color(1, 1, 1) + self.self_modulate = Color(1, 1, 1) else: - self.modulate = Color(0.2, 0.2, 0.2) + self.self_modulate = Color(0.2, 0.2, 0.2) sparkling = false func _set_sparkling(new_sparkling): sparkling = new_sparkling if $Particles2D: $Particles2D.emitting = sparkling + +func _set_impossible(new_impossible): + impossible = new_impossible + $Nope.visible = impossible diff --git a/scenes/cli_badge.tscn b/scenes/cli_badge.tscn index 30f6d15..740e2a3 100644 --- a/scenes/cli_badge.tscn +++ b/scenes/cli_badge.tscn @@ -43,3 +43,11 @@ z_index = 1 amount = 3 randomness = 0.34 process_material = SubResource( 3 ) + +[node name="Nope" type="Line2D" parent="."] +visible = false +position = Vector2( 22.4111, 18.7121 ) +scale = Vector2( 1.32773, 1.32773 ) +points = PoolVector2Array( -16.448, 11.5553, 16.0161, -12.8519 ) +width = 5.0 +default_color = Color( 0.0705882, 0.0705882, 0.0705882, 1 ) diff --git a/scenes/main.gd b/scenes/main.gd index f3d7c11..0ad09c2 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -50,8 +50,8 @@ func _process(delta): var length = _hint_client_connection.get_u32() var message = _hint_client_connection.get_string(length) game.notify(message) - if game.used_cards: - $Menu/CLIBadge.active = false +# if game.used_cards: +# $Menu/CLIBadge.impossible = true # Magic height number to fix a weird rescaling bug that affected # the Rows height. @@ -67,8 +67,6 @@ func load_level(level_id): level_description.show() game.current_level = level_id game.used_cards = false - $Menu/CLIBadge.active = true - $Menu/CLIBadge.sparkling = false AudioServer.set_bus_mute(AudioServer.get_bus_index("SFX"), true) @@ -78,6 +76,11 @@ func load_level(level_id): level_description.bbcode_text = level.description[0] level_congrats.bbcode_text = level.congrats level_name.text = level.title + + var slug = levels.chapters[game.current_chapter].slug + "/" + level.slug + $Menu/CLIBadge.active = slug in game.state["cli_badge"] + $Menu/CLIBadge.sparkling = false + #if levels.chapters[game.current_chapter].levels[game.current_level].cards.size() == 0: # cards.redraw_all_cards() #else: @@ -184,6 +187,7 @@ func show_win_status(win_states): if not game.used_cards and not slug in game.state["cli_badge"]: game.state["cli_badge"].push_back(slug) game.save_state() + $Menu/CLIBadge.active = true $Menu/CLIBadge.sparkling = true #func repopulate_levels():