diff --git a/README.md b/README.md index 5784771..2db1a1c 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,11 @@ We have a [Code of Conduct](CODE_OF_CONDUCT.md) in place that applies to all pro ## Thanks - "success" sound by [Leszek_Szarzy, CC0](https://freesound.org/people/Leszek_Szary/sounds/171670/) +- "swish" sound by [jawbutch, CC0](https://freesound.org/people/jawbutch/sounds/344408/) +- "swoosh" sound by [WizardOZ, CC0](https://freesound.org/people/WizardOZ/sounds/419341/) +- "poof" sound by [Saviraz, CC0](https://freesound.org/people/Saviraz/sounds/512217/) +- "buzzer" sound by [Loyalty_Freak_Music, CC0](https://freesound.org/people/Loyalty_Freak_Music/sounds/407466/) +- "typewriter_ding" sound by [_stubb, CC0](https://freesound.org/people/_stubb/sounds/406243/) ## License diff --git a/card.gd b/card.gd index 51d4c8f..0280191 100644 --- a/card.gd +++ b/card.gd @@ -54,6 +54,7 @@ func _unhandled_input(event): if event.button_index == BUTTON_LEFT and event.pressed and hovered: dragged = true game.dragged_object = self + $PickupSound.play() drag_offset = get_viewport().get_mouse_position() - global_position get_tree().set_input_as_handled() modulate.a = 0.5 @@ -94,6 +95,7 @@ func set_energy(new_energy): func move_back(): position = _home_position rotation_degrees = _home_rotation + $ReturnSound.play() func buuurn(): move_back() @@ -120,6 +122,10 @@ func dropped_on(other): func try_play(command): if game.energy >= energy: + $PlaySound.play() + var particles = preload("res://card_particles.tscn").instance() + particles.position = position + get_parent().add_child(particles) $"../../..".terminal.send_command(command) buuurn() game.energy -= energy diff --git a/card.tscn b/card.tscn index 916ac4d..6700441 100644 --- a/card.tscn +++ b/card.tscn @@ -1,8 +1,11 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://card.gd" type="Script" id=1] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2] [ext_resource path="res://nodes/blob.svg" type="Texture" id=3] +[ext_resource path="res://sounds/poof.wav" type="AudioStream" id=4] +[ext_resource path="res://sounds/swish.wav" type="AudioStream" id=5] +[ext_resource path="res://sounds/swoosh.wav" type="AudioStream" id=6] [sub_resource type="StyleBoxFlat" id=1] bg_color = Color( 0.45098, 0.584314, 0.843137, 1 ) @@ -117,5 +120,16 @@ valign = 1 __meta__ = { "_edit_use_anchors_": false } + +[node name="PickupSound" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 5 ) + +[node name="PlaySound" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 4 ) +volume_db = -6.848 + +[node name="ReturnSound" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 6 ) +volume_db = -6.848 [connection signal="mouse_entered" from="Area2D" to="." method="_mouse_entered"] [connection signal="mouse_exited" from="Area2D" to="." method="_mouse_exited"] diff --git a/card_particles.tscn b/card_particles.tscn new file mode 100644 index 0000000..64fd9e2 --- /dev/null +++ b/card_particles.tscn @@ -0,0 +1,67 @@ +[gd_scene load_steps=5 format=2] + +[sub_resource type="Curve" id=1] +_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), -2.75937, 0.0, 0, 0 ] + +[sub_resource type="CurveTexture" id=2] +curve = SubResource( 1 ) + +[sub_resource type="ParticlesMaterial" id=3] +emission_shape = 2 +emission_box_extents = Vector3( 100, 150, 1 ) +flag_disable_z = true +spread = 180.0 +gravity = Vector3( 0, 0, 0 ) +initial_velocity = 232.55 +initial_velocity_random = 0.52 +orbit_velocity = 0.0 +orbit_velocity_random = 0.0 +scale = 14.95 +scale_curve = SubResource( 2 ) +color = Color( 0.223529, 0.592157, 0.772549, 1 ) + +[sub_resource type="Animation" id=4] +resource_name = "play" +length = 2.0 +tracks/0/type = "method" +tracks/0/path = NodePath(".") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 2 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "queue_free" +} ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Particles:emitting") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} + +[node name="CardParticles" type="Node2D"] + +[node name="Particles" type="Particles2D" parent="."] +position = Vector2( -0.539337, -145.087 ) +emitting = false +amount = 32 +lifetime = 0.2 +one_shot = true +explosiveness = 0.91 +local_coords = false +process_material = SubResource( 3 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +autoplay = "play" +anims/play = SubResource( 4 ) diff --git a/helpers.gd b/helpers.gd index 2bb1200..df2c83e 100644 --- a/helpers.gd +++ b/helpers.gd @@ -27,7 +27,7 @@ func exec(command, args=[], crash_on_fail=true): elif debug: print("Output: %s" %output) - return output + return {"output": output, "exit_code": exit_code} # Return the contents of a file. If no fallback_string is provided, crash when # the file doesn't exist. diff --git a/levels/time-machine/branches b/levels/time-machine/branches index ef16e9e..88a6a80 100644 --- a/levels/time-machine/branches +++ b/levels/time-machine/branches @@ -1,3 +1,5 @@ +title = Parallel timelines + [description] In this zoo, we found a few parallel timelines. Feel free to travel between the commits to see what's going on! The ends of the timelines have little tags attached. diff --git a/levels/time-machine/conflict b/levels/time-machine/conflict index 1d66b54..748d55b 100644 --- a/levels/time-machine/conflict +++ b/levels/time-machine/conflict @@ -1,3 +1,5 @@ +title = Contradictions + [description] Sometimes, merging timelines will not be as simple, because they contradict each other. diff --git a/levels/time-machine/merge b/levels/time-machine/merge index 2e464ae..0e672c7 100644 --- a/levels/time-machine/merge +++ b/levels/time-machine/merge @@ -1,3 +1,5 @@ +title = Merging timelines + [description] Didn't get enouth sleep last night? Here's a trick so that you can sleep a bit longer: just do all your morning activities in parallel universes, and then at the end, merge them together! diff --git a/levels/time-machine/pull-push b/levels/time-machine/pull-push index 1e316d6..626d9a6 100644 --- a/levels/time-machine/pull-push +++ b/levels/time-machine/pull-push @@ -1,3 +1,5 @@ +title = Helping each other + [description] The events and timelines you see are always only what your own time machine knows about! diff --git a/levels/time-machine/rebase b/levels/time-machine/rebase index 5f190ee..882585a 100644 --- a/levels/time-machine/rebase +++ b/levels/time-machine/rebase @@ -1,3 +1,5 @@ +title = No parallels allowed + [description] Okay - turns out that saving time in the morning by utilizing parallel universes is against the regulations of the International Time Travel Association. You'll have to do your tasks in sequence after all. diff --git a/levels/time-machine/reorder b/levels/time-machine/reorder index 03f412a..186f566 100644 --- a/levels/time-machine/reorder +++ b/levels/time-machine/reorder @@ -1,3 +1,5 @@ +title = Reodering events + [description] Oops, looks like one of our time agents messed up here. Can you put the events back into their correct order? diff --git a/levels/time-machine/welcome b/levels/time-machine/welcome index cadb3f0..61e5d3f 100644 --- a/levels/time-machine/welcome +++ b/levels/time-machine/welcome @@ -1,3 +1,5 @@ +title = Welcome! + [description] Welcome, time agent! Good to see you - we could really use your help with fixing some temporal paradoxes! diff --git a/main.gd b/main.gd index 396faa4..d226d9d 100644 --- a/main.gd +++ b/main.gd @@ -88,6 +88,7 @@ func load_level(level_id): terminal.repository = repositories[repo_names[repo_names.size()-1]] terminal.clear() + terminal.find_node("TextEditor").close() # Unmute the audio after a while, so that player can hear pop sounds for # nodes they create. @@ -108,10 +109,11 @@ func load_next_level(): load_level(current_level) func show_win_status(): - next_level_button.show() - level_description.hide() - level_congrats.show() - $SuccessSound.play() + if not level_congrats.visible: + next_level_button.show() + level_description.hide() + level_congrats.show() + $SuccessSound.play() func repopulate_levels(): levels.reload() diff --git a/node.tscn b/node.tscn index 1a5a965..f2cd14a 100644 --- a/node.tscn +++ b/node.tscn @@ -68,6 +68,7 @@ shape = SubResource( 1 ) z_index = 1 [node name="ContentLabel" type="Label" parent="Content"] +visible = false margin_left = -22.2898 margin_top = 30.1969 margin_right = -12.2898 diff --git a/shell.gd b/shell.gd index db9d7ba..daf5046 100644 --- a/shell.gd +++ b/shell.gd @@ -1,8 +1,10 @@ extends Node class_name Shell +var exit_code + var _cwd -var os = OS.get_name() +var _os = OS.get_name() #signal output(text) @@ -50,25 +52,26 @@ func run(command, crash_on_fail=true): # "'test '"'"'fu'"'"' "bla" blubb" # # Quoting Magic is not needed for Windows! - if os == "X11" or os == "OSX": + if _os == "X11" or _os == "OSX": hacky_command = '"\''+hacky_command.replace("'", "'\"'\"'")+'\'"' - var output = helpers.exec(_shell_binary(), ["-c", hacky_command], crash_on_fail) + var result = helpers.exec(_shell_binary(), ["-c", hacky_command], crash_on_fail) + exit_code = result["exit_code"] if debug: - print(output) + print(result["output"]) - return output + return result["output"] func _shell_binary(): - if os == "X11" or os == "OSX": + if _os == "X11" or _os == "OSX": return "bash" - elif os == "Windows": + elif _os == "Windows": return "dependencies\\windows\\git\\bin\\bash.exe" else: - helpers.crash("Unsupported OS: %s" % os) + helpers.crash("Unsupported OS: %s" % _os) var _t func run_async(command): diff --git a/sounds/buzzer.wav b/sounds/buzzer.wav new file mode 100644 index 0000000..f797628 Binary files /dev/null and b/sounds/buzzer.wav differ diff --git a/sounds/buzzer.wav.import b/sounds/buzzer.wav.import new file mode 100644 index 0000000..0df076d --- /dev/null +++ b/sounds/buzzer.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/buzzer.wav-2dd9ed8c0fc10c99ff5279a9bd90ea75.sample" + +[deps] + +source_file="res://sounds/buzzer.wav" +dest_files=[ "res://.import/buzzer.wav-2dd9ed8c0fc10c99ff5279a9bd90ea75.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/sounds/poof.wav b/sounds/poof.wav new file mode 100644 index 0000000..cd7b5aa Binary files /dev/null and b/sounds/poof.wav differ diff --git a/sounds/poof.wav.import b/sounds/poof.wav.import new file mode 100644 index 0000000..57110c6 --- /dev/null +++ b/sounds/poof.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/poof.wav-db49a4251469e51fe6b35ddc6fb05dcc.sample" + +[deps] + +source_file="res://sounds/poof.wav" +dest_files=[ "res://.import/poof.wav-db49a4251469e51fe6b35ddc6fb05dcc.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/sounds/swish.wav b/sounds/swish.wav new file mode 100644 index 0000000..967d488 Binary files /dev/null and b/sounds/swish.wav differ diff --git a/sounds/swish.wav.import b/sounds/swish.wav.import new file mode 100644 index 0000000..6eda4c4 --- /dev/null +++ b/sounds/swish.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/swish.wav-e61d890ee6364cfac7a66a257b308699.sample" + +[deps] + +source_file="res://sounds/swish.wav" +dest_files=[ "res://.import/swish.wav-e61d890ee6364cfac7a66a257b308699.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/sounds/swoosh.wav b/sounds/swoosh.wav new file mode 100644 index 0000000..e85b474 Binary files /dev/null and b/sounds/swoosh.wav differ diff --git a/sounds/swoosh.wav.import b/sounds/swoosh.wav.import new file mode 100644 index 0000000..78d86f8 --- /dev/null +++ b/sounds/swoosh.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/swoosh.wav-d94298cb8d05e0380c25da11f976f097.sample" + +[deps] + +source_file="res://sounds/swoosh.wav" +dest_files=[ "res://.import/swoosh.wav-d94298cb8d05e0380c25da11f976f097.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/sounds/typewriter_ding.wav b/sounds/typewriter_ding.wav new file mode 100644 index 0000000..e35cf35 Binary files /dev/null and b/sounds/typewriter_ding.wav differ diff --git a/sounds/typewriter_ding.wav.import b/sounds/typewriter_ding.wav.import new file mode 100644 index 0000000..59f1cf7 --- /dev/null +++ b/sounds/typewriter_ding.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/typewriter_ding.wav-261baf709f530d1d0a04e5c5a6efc553.sample" + +[deps] + +source_file="res://sounds/typewriter_ding.wav" +dest_files=[ "res://.import/typewriter_ding.wav-261baf709f530d1d0a04e5c5a6efc553.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/terminal.gd b/terminal.gd index 198eed5..4c8c0ff 100644 --- a/terminal.gd +++ b/terminal.gd @@ -120,6 +120,11 @@ func send_command_async(command): func run_command_in_a_thread(command): var o = repository.shell.run(command, false) + if repository.shell.exit_code == 0: + $OkSound.play() + else: + $ErrorSound.play() + input.text = "" input.editable = true diff --git a/terminal.tscn b/terminal.tscn index ce6b697..8ad2c79 100644 --- a/terminal.tscn +++ b/terminal.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1] [ext_resource path="res://terminal.gd" type="Script" id=2] @@ -6,6 +6,8 @@ [ext_resource path="res://fonts/monospace.tres" type="DynamicFont" id=4] [ext_resource path="res://text_editor.tscn" type="PackedScene" id=5] [ext_resource path="res://button.gd" type="Script" id=6] +[ext_resource path="res://sounds/buzzer.wav" type="AudioStream" id=7] +[ext_resource path="res://sounds/typewriter_ding.wav" type="AudioStream" id=8] [sub_resource type="StyleBoxFlat" id=1] content_margin_left = 5.0 @@ -154,6 +156,12 @@ custom_fonts/normal_font = ExtResource( 4 ) __meta__ = { "_edit_use_anchors_": false } + +[node name="ErrorSound" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 7 ) + +[node name="OkSound" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 8 ) [connection signal="item_selected" from="Rows/TopHalf/Completions" to="." method="_completion_selected"] [connection signal="pressed" from="Rows/VBoxContainer/Button" to="Rows/VBoxContainer/Button" method="pressed"] [connection signal="pressed" from="Rows/VBoxContainer/Button2" to="Rows/VBoxContainer/Button2" method="pressed"] diff --git a/text_editor.gd b/text_editor.gd index fc8e522..eee959a 100644 --- a/text_editor.gd +++ b/text_editor.gd @@ -46,7 +46,7 @@ func save(): close() func close(): - if _client_connection.is_connected_to_host(): + if _client_connection and _client_connection.is_connected_to_host(): _client_connection.disconnect_from_host() text = "" hide()