Card particles and more sound effects

This commit is contained in:
Sebastian Morr 2020-10-22 16:19:22 +02:00
parent 17b8c64a1d
commit 5d59623392
28 changed files with 246 additions and 16 deletions

View file

@ -91,6 +91,11 @@ We have a [Code of Conduct](CODE_OF_CONDUCT.md) in place that applies to all pro
## Thanks ## Thanks
- "success" sound by [Leszek_Szarzy, CC0](https://freesound.org/people/Leszek_Szary/sounds/171670/) - "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 ## License

View file

@ -54,6 +54,7 @@ func _unhandled_input(event):
if event.button_index == BUTTON_LEFT and event.pressed and hovered: if event.button_index == BUTTON_LEFT and event.pressed and hovered:
dragged = true dragged = true
game.dragged_object = self game.dragged_object = self
$PickupSound.play()
drag_offset = get_viewport().get_mouse_position() - global_position drag_offset = get_viewport().get_mouse_position() - global_position
get_tree().set_input_as_handled() get_tree().set_input_as_handled()
modulate.a = 0.5 modulate.a = 0.5
@ -94,6 +95,7 @@ func set_energy(new_energy):
func move_back(): func move_back():
position = _home_position position = _home_position
rotation_degrees = _home_rotation rotation_degrees = _home_rotation
$ReturnSound.play()
func buuurn(): func buuurn():
move_back() move_back()
@ -120,6 +122,10 @@ func dropped_on(other):
func try_play(command): func try_play(command):
if game.energy >= energy: 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) $"../../..".terminal.send_command(command)
buuurn() buuurn()
game.energy -= energy game.energy -= energy

View file

@ -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://card.gd" type="Script" id=1]
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2] [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://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] [sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.45098, 0.584314, 0.843137, 1 ) bg_color = Color( 0.45098, 0.584314, 0.843137, 1 )
@ -117,5 +120,16 @@ valign = 1
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_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_entered" from="Area2D" to="." method="_mouse_entered"]
[connection signal="mouse_exited" from="Area2D" to="." method="_mouse_exited"] [connection signal="mouse_exited" from="Area2D" to="." method="_mouse_exited"]

67
card_particles.tscn Normal file
View file

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

View file

@ -27,7 +27,7 @@ func exec(command, args=[], crash_on_fail=true):
elif debug: elif debug:
print("Output: %s" %output) 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 # Return the contents of a file. If no fallback_string is provided, crash when
# the file doesn't exist. # the file doesn't exist.

View file

@ -1,3 +1,5 @@
title = Parallel timelines
[description] [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. 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.

View file

@ -1,3 +1,5 @@
title = Contradictions
[description] [description]
Sometimes, merging timelines will not be as simple, because they contradict each other. Sometimes, merging timelines will not be as simple, because they contradict each other.

View file

@ -1,3 +1,5 @@
title = Merging timelines
[description] [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! 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!

View file

@ -1,3 +1,5 @@
title = Helping each other
[description] [description]
The events and timelines you see are always only what your own time machine knows about! The events and timelines you see are always only what your own time machine knows about!

View file

@ -1,3 +1,5 @@
title = No parallels allowed
[description] [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. 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.

View file

@ -1,3 +1,5 @@
title = Reodering events
[description] [description]
Oops, looks like one of our time agents messed up here. Can you put the events back into their correct order? Oops, looks like one of our time agents messed up here. Can you put the events back into their correct order?

View file

@ -1,3 +1,5 @@
title = Welcome!
[description] [description]
Welcome, time agent! Good to see you - we could really use your help with fixing some temporal paradoxes! Welcome, time agent! Good to see you - we could really use your help with fixing some temporal paradoxes!

10
main.gd
View file

@ -88,6 +88,7 @@ func load_level(level_id):
terminal.repository = repositories[repo_names[repo_names.size()-1]] terminal.repository = repositories[repo_names[repo_names.size()-1]]
terminal.clear() terminal.clear()
terminal.find_node("TextEditor").close()
# Unmute the audio after a while, so that player can hear pop sounds for # Unmute the audio after a while, so that player can hear pop sounds for
# nodes they create. # nodes they create.
@ -108,10 +109,11 @@ func load_next_level():
load_level(current_level) load_level(current_level)
func show_win_status(): func show_win_status():
next_level_button.show() if not level_congrats.visible:
level_description.hide() next_level_button.show()
level_congrats.show() level_description.hide()
$SuccessSound.play() level_congrats.show()
$SuccessSound.play()
func repopulate_levels(): func repopulate_levels():
levels.reload() levels.reload()

View file

@ -68,6 +68,7 @@ shape = SubResource( 1 )
z_index = 1 z_index = 1
[node name="ContentLabel" type="Label" parent="Content"] [node name="ContentLabel" type="Label" parent="Content"]
visible = false
margin_left = -22.2898 margin_left = -22.2898
margin_top = 30.1969 margin_top = 30.1969
margin_right = -12.2898 margin_right = -12.2898

View file

@ -1,8 +1,10 @@
extends Node extends Node
class_name Shell class_name Shell
var exit_code
var _cwd var _cwd
var os = OS.get_name() var _os = OS.get_name()
#signal output(text) #signal output(text)
@ -50,25 +52,26 @@ func run(command, crash_on_fail=true):
# "'test '"'"'fu'"'"' "bla" blubb" # "'test '"'"'fu'"'"' "bla" blubb"
# #
# Quoting Magic is not needed for Windows! # Quoting Magic is not needed for Windows!
if os == "X11" or os == "OSX": if _os == "X11" or _os == "OSX":
hacky_command = '"\''+hacky_command.replace("'", "'\"'\"'")+'\'"' 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: if debug:
print(output) print(result["output"])
return output return result["output"]
func _shell_binary(): func _shell_binary():
if os == "X11" or os == "OSX": if _os == "X11" or _os == "OSX":
return "bash" return "bash"
elif os == "Windows": elif _os == "Windows":
return "dependencies\\windows\\git\\bin\\bash.exe" return "dependencies\\windows\\git\\bin\\bash.exe"
else: else:
helpers.crash("Unsupported OS: %s" % os) helpers.crash("Unsupported OS: %s" % _os)
var _t var _t
func run_async(command): func run_async(command):

BIN
sounds/buzzer.wav Normal file

Binary file not shown.

21
sounds/buzzer.wav.import Normal file
View file

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

BIN
sounds/poof.wav Normal file

Binary file not shown.

21
sounds/poof.wav.import Normal file
View file

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

BIN
sounds/swish.wav Normal file

Binary file not shown.

21
sounds/swish.wav.import Normal file
View file

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

BIN
sounds/swoosh.wav Normal file

Binary file not shown.

21
sounds/swoosh.wav.import Normal file
View file

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

BIN
sounds/typewriter_ding.wav Normal file

Binary file not shown.

View file

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

View file

@ -120,6 +120,11 @@ func send_command_async(command):
func run_command_in_a_thread(command): func run_command_in_a_thread(command):
var o = repository.shell.run(command, false) var o = repository.shell.run(command, false)
if repository.shell.exit_code == 0:
$OkSound.play()
else:
$ErrorSound.play()
input.text = "" input.text = ""
input.editable = true input.editable = true

View file

@ -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://fonts/default.tres" type="DynamicFont" id=1]
[ext_resource path="res://terminal.gd" type="Script" id=2] [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://fonts/monospace.tres" type="DynamicFont" id=4]
[ext_resource path="res://text_editor.tscn" type="PackedScene" id=5] [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://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] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 5.0 content_margin_left = 5.0
@ -154,6 +156,12 @@ custom_fonts/normal_font = ExtResource( 4 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_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="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/Button" to="Rows/VBoxContainer/Button" method="pressed"]
[connection signal="pressed" from="Rows/VBoxContainer/Button2" to="Rows/VBoxContainer/Button2" method="pressed"] [connection signal="pressed" from="Rows/VBoxContainer/Button2" to="Rows/VBoxContainer/Button2" method="pressed"]

View file

@ -46,7 +46,7 @@ func save():
close() close()
func 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() _client_connection.disconnect_from_host()
text = "" text = ""
hide() hide()