diff --git a/godot/assets/music/level2.ogg b/godot/assets/music/level2.ogg index ebb3231..548241f 100644 --- a/godot/assets/music/level2.ogg +++ b/godot/assets/music/level2.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4fe1597eeec1f308631c10c37e6457d16429c6692a1a6db9bb2641d58facd030 -size 1605670 +oid sha256:7f80b1f828f132293790f730b899596631e3f5de834dca0bc66d4335ba648893 +size 1053717 diff --git a/godot/assets/sounds/coin.wav b/godot/assets/sounds/coin.wav new file mode 100644 index 0000000..437d810 --- /dev/null +++ b/godot/assets/sounds/coin.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3feda8ae12b154d33c41d286bfc8423acb5bd30027de8590b44179ccdaefe0f6 +size 132564 diff --git a/godot/assets/sounds/coin.wav.import b/godot/assets/sounds/coin.wav.import new file mode 100644 index 0000000..f7e7100 --- /dev/null +++ b/godot/assets/sounds/coin.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/coin.wav-9081ee1c6d81d9c34d08bc916297b892.sample" + +[deps] + +source_file="res://assets/sounds/coin.wav" +dest_files=[ "res://.import/coin.wav-9081ee1c6d81d9c34d08bc916297b892.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_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/godot/assets/sounds/died.wav b/godot/assets/sounds/died.wav new file mode 100644 index 0000000..96f68c5 --- /dev/null +++ b/godot/assets/sounds/died.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ef38b521ccfa436c210c13ba14731b093fc1c6564da6e6d5a008c959c9cb517 +size 857132 diff --git a/godot/assets/sounds/died.wav.import b/godot/assets/sounds/died.wav.import new file mode 100644 index 0000000..b92b919 --- /dev/null +++ b/godot/assets/sounds/died.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/died.wav-fc4528ad616bbce5115ae092cb80d346.sample" + +[deps] + +source_file="res://assets/sounds/died.wav" +dest_files=[ "res://.import/died.wav-fc4528ad616bbce5115ae092cb80d346.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_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/godot/assets/sounds/gem.wav b/godot/assets/sounds/gem.wav new file mode 100644 index 0000000..b4eb998 --- /dev/null +++ b/godot/assets/sounds/gem.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec7fa9358699bc8f9be0cb47c027efc2099803f5fc81d24aac066ae5f2b3a406 +size 145348 diff --git a/godot/assets/sounds/gem.wav.import b/godot/assets/sounds/gem.wav.import new file mode 100644 index 0000000..60eb36b --- /dev/null +++ b/godot/assets/sounds/gem.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/gem.wav-49535e5638777427fa416449f386aaf6.sample" + +[deps] + +source_file="res://assets/sounds/gem.wav" +dest_files=[ "res://.import/gem.wav-49535e5638777427fa416449f386aaf6.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_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/godot/assets/sounds/jump.wav b/godot/assets/sounds/jump.wav new file mode 100644 index 0000000..03982ea --- /dev/null +++ b/godot/assets/sounds/jump.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:147904084c9eaea71eae200292905b3adb41d862e0e09b5aab866cfb28ba4576 +size 176602 diff --git a/godot/assets/sounds/jump.wav.import b/godot/assets/sounds/jump.wav.import new file mode 100644 index 0000000..f8e1faf --- /dev/null +++ b/godot/assets/sounds/jump.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/jump.wav-395b727cde98999423d5c020c9c3492f.sample" + +[deps] + +source_file="res://assets/sounds/jump.wav" +dest_files=[ "res://.import/jump.wav-395b727cde98999423d5c020c9c3492f.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_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/godot/assets/sounds/ui_popup.wav b/godot/assets/sounds/ui_popup.wav new file mode 100644 index 0000000..f00a22a --- /dev/null +++ b/godot/assets/sounds/ui_popup.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7af5be9759b98365633e251a6a0c72f4840975f141a9d57e40ea70ab4beebbc2 +size 51772 diff --git a/godot/assets/sounds/ui_popup.wav.import b/godot/assets/sounds/ui_popup.wav.import new file mode 100644 index 0000000..679a364 --- /dev/null +++ b/godot/assets/sounds/ui_popup.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/ui_popup.wav-b70bc280bf50aa4e775c08111118c3ae.sample" + +[deps] + +source_file="res://assets/sounds/ui_popup.wav" +dest_files=[ "res://.import/ui_popup.wav-b70bc280bf50aa4e775c08111118c3ae.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_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/godot/assets/sounds/ui_select.wav b/godot/assets/sounds/ui_select.wav new file mode 100644 index 0000000..ec3580d --- /dev/null +++ b/godot/assets/sounds/ui_select.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e43e035f6953c9854eee64f2f45b8d7d7107a412b82bbbe625253e1103c1bbb1 +size 62564 diff --git a/godot/assets/sounds/ui_select.wav.import b/godot/assets/sounds/ui_select.wav.import new file mode 100644 index 0000000..3e3d8c0 --- /dev/null +++ b/godot/assets/sounds/ui_select.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/ui_select.wav-a1e6656879b8474ab79f3a15e3073001.sample" + +[deps] + +source_file="res://assets/sounds/ui_select.wav" +dest_files=[ "res://.import/ui_select.wav-a1e6656879b8474ab79f3a15e3073001.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_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/godot/characters/player/Player.tscn b/godot/characters/player/Player.tscn index 3209ffa..89b38d9 100644 --- a/godot/characters/player/Player.tscn +++ b/godot/characters/player/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://characters/player/sprites/green.tres" type="SpriteFrames" id=1] [ext_resource path="res://characters/player/states/Idle.gdns" type="Script" id=2] @@ -7,6 +7,7 @@ [ext_resource path="res://characters/player/Player.gdns" type="Script" id=5] [ext_resource path="res://characters/player/states/Jump.gdns" type="Script" id=6] [ext_resource path="res://characters/player/states/Fall.gdns" type="Script" id=7] +[ext_resource path="res://assets/sounds/jump.wav" type="AudioStream" id=8] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 7, 12 ) @@ -22,7 +23,7 @@ centered = false flip_h = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2( 12.5, 12.5 ) +position = Vector2( 12, 12 ) shape = SubResource( 1 ) [node name="StateMachine" type="Node" parent="."] @@ -46,3 +47,8 @@ position = Vector2( 12, 0 ) enabled = true cast_to = Vector2( 0, 32 ) collision_mask = 24 + +[node name="Sounds" type="Node" parent="."] + +[node name="Jump" type="AudioStreamPlayer" parent="Sounds"] +stream = ExtResource( 8 ) diff --git a/godot/monitor/GUI.tscn b/godot/monitor/GUI.tscn index e2962a7..08187b6 100644 --- a/godot/monitor/GUI.tscn +++ b/godot/monitor/GUI.tscn @@ -1,9 +1,12 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=17 format=2] [ext_resource path="res://assets/fonts/data/PixelOperator.tres" type="DynamicFontData" id=1] [ext_resource path="res://assets/fonts/data/PixelOperator-Bold.tres" type="DynamicFontData" id=2] [ext_resource path="res://monitor/Rut.gd" type="Script" id=3] +[ext_resource path="res://monitor/UISounds.gd" type="Script" id=4] [ext_resource path="res://monitor/EnterButton.gd" type="Script" id=5] +[ext_resource path="res://assets/sounds/ui_popup.wav" type="AudioStream" id=6] +[ext_resource path="res://assets/sounds/ui_select.wav" type="AudioStream" id=7] [sub_resource type="DynamicFont" id=1] font_data = ExtResource( 1 ) @@ -77,6 +80,15 @@ anchor_right = 1.0 anchor_bottom = 1.0 rect_min_size = Vector2( 512, 0 ) +[node name="Sounds" type="Node" parent="GUI"] +script = ExtResource( 4 ) + +[node name="Popup" type="AudioStreamPlayer" parent="GUI/Sounds"] +stream = ExtResource( 6 ) + +[node name="Menu" type="AudioStreamPlayer" parent="GUI/Sounds"] +stream = ExtResource( 7 ) + [node name="VBoxContainer" type="VBoxContainer" parent="GUI"] anchor_right = 1.0 anchor_bottom = 1.0 @@ -221,6 +233,11 @@ align = 1 valign = 1 autowrap = true +[connection signal="focus_entered" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Name" to="GUI/Sounds" method="_play_ui_select_sound"] +[connection signal="focus_entered" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Rut" to="GUI/Sounds" method="_play_ui_select_sound"] [connection signal="text_changed" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Rut" to="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Rut" method="_on_Rut_text_changed"] +[connection signal="focus_entered" from="GUI/VBoxContainer/CenterContainer2/VBoxContainer2/Email" to="GUI/Sounds" method="_play_ui_select_sound"] +[connection signal="focus_entered" from="GUI/VBoxContainer/CenterContainer3/Button" to="GUI/Sounds" method="_play_ui_select_sound"] [connection signal="pressed" from="GUI/VBoxContainer/CenterContainer3/Button" to="GUI/VBoxContainer/CenterContainer3/Button" method="_on_Button_pressed"] +[connection signal="focus_entered" from="PopupDialog" to="GUI/Sounds" method="_play_popup_sound"] [connection signal="gui_input" from="PopupDialog" to="GUI/VBoxContainer/CenterContainer3/Button" method="_on_PopupDialog_gui_input"] diff --git a/godot/monitor/UISounds.gd b/godot/monitor/UISounds.gd new file mode 100644 index 0000000..b0821c6 --- /dev/null +++ b/godot/monitor/UISounds.gd @@ -0,0 +1,9 @@ +extends Node + + +func _play_popup_sound() -> void: + $Popup.play() + + +func _play_ui_select_sound() -> void: + $Menu.play() diff --git a/src/player/states/PlayerJump.cpp b/src/player/states/PlayerJump.cpp index 8255e1b..e9f9082 100644 --- a/src/player/states/PlayerJump.cpp +++ b/src/player/states/PlayerJump.cpp @@ -1,6 +1,8 @@ #include "player/states/PlayerJump.h" #include "player/Player.h" +#include + using namespace godot; using namespace player; @@ -26,6 +28,9 @@ void PlayerJump::_init() void PlayerJump::_state_enter(const String state) { + auto jump_sound = get_parent()->get_node("Sounds/Jump"); + jump_sound->play(); + animated_sprite = get_parent()->get_node("AnimatedSprite"); animated_sprite->stop(); animated_sprite->set_animation("air");