diff --git a/project/project.godot b/project/project.godot index d6f3c83..407b766 100644 --- a/project/project.godot +++ b/project/project.godot @@ -199,6 +199,11 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://src/Ships/Guns/LaserGun/LaserGun.gd" }, { +"base": "AudioStreamPlayer2D", +"class": "LoopingAudioStreamPlayer2D", +"language": "GDScript", +"path": "res://src/Common/LoopingAudioStreamPlayer2D.gd" +}, { "base": "Resource", "class": "MapIcon", "language": "GDScript", @@ -333,6 +338,7 @@ _global_script_class_icons={ "GameWorld": "", "Gun": "", "LaserGun": "", +"LoopingAudioStreamPlayer2D": "", "MapIcon": "", "MapSprite": "", "MapView": "", diff --git a/project/src/Common/LoopingAudioStreamPlayer2D.gd b/project/src/Common/LoopingAudioStreamPlayer2D.gd new file mode 100644 index 0000000..34e69e6 --- /dev/null +++ b/project/src/Common/LoopingAudioStreamPlayer2D.gd @@ -0,0 +1,29 @@ +class_name LoopingAudioStreamPlayer2D +extends AudioStreamPlayer2D + +export var start: AudioStream +export var loop: AudioStream +export var tail: AudioStream + +var ending := false + + +func _ready() -> void: + connect("finished", self, "_on_finished") + + +func start() -> void: + stream = start + ending = false + play() + + +func end() -> void: + stream = tail + ending = true + + +func _on_finished() -> void: + if stream == start: + stream = loop + play() diff --git a/project/src/Ships/Guns/LaserGun/LaserGun.gd b/project/src/Ships/Guns/LaserGun/LaserGun.gd index 5f7b775..1d7a8cc 100644 --- a/project/src/Ships/Guns/LaserGun/LaserGun.gd +++ b/project/src/Ships/Guns/LaserGun/LaserGun.gd @@ -9,6 +9,8 @@ export var damage_per_second := 200.0 onready var laser_beam := $LaserBeam2D onready var shooter := owner +onready var audio: LoopingAudioStreamPlayer2D = $LoopingAudioStreamPlayer2D + var is_firing := false setget set_is_firing var collision_mask := 0 setget set_collision_mask @@ -28,6 +30,10 @@ func set_is_firing(firing: bool) -> void: set_physics_process(is_firing) laser_beam.is_casting = is_firing + if is_firing: + audio.start() + else: + audio.end() func set_collision_mask(new_mask: int) -> void: diff --git a/project/src/Ships/Guns/LaserGun/LaserGun.tscn b/project/src/Ships/Guns/LaserGun/LaserGun.tscn index 91e57ac..82e4b1b 100644 --- a/project/src/Ships/Guns/LaserGun/LaserGun.tscn +++ b/project/src/Ships/Guns/LaserGun/LaserGun.tscn @@ -1,10 +1,23 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://src/VFX/LaserBeam/LaserBeam.tscn" type="PackedScene" id=1] [ext_resource path="res://src/Ships/Guns/LaserGun/LaserGun.gd" type="Script" id=2] +[ext_resource path="res://src/Ships/Guns/LaserGun/Weapons_Beam_Loop.wav" type="AudioStream" id=3] +[ext_resource path="res://src/Common/LoopingAudioStreamPlayer2D.gd" type="Script" id=4] +[ext_resource path="res://src/Ships/Guns/LaserGun/Weapons_Beam_Start.wav" type="AudioStream" id=5] +[ext_resource path="res://src/Ships/Guns/LaserGun/Weapons_Beam_End.wav" type="AudioStream" id=6] [node name="LaserGun" type="Node2D"] script = ExtResource( 2 ) damage_per_second = 300.0 [node name="LaserBeam2D" parent="." instance=ExtResource( 1 )] + +[node name="LoopingAudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +script = ExtResource( 4 ) +__meta__ = { +"_editor_description_": "" +} +start = ExtResource( 5 ) +loop = ExtResource( 3 ) +tail = ExtResource( 6 ) diff --git a/project/src/Ships/Guns/LaserGun/Weapons_Beam_End.wav b/project/src/Ships/Guns/LaserGun/Weapons_Beam_End.wav new file mode 100644 index 0000000..44d44fa Binary files /dev/null and b/project/src/Ships/Guns/LaserGun/Weapons_Beam_End.wav differ diff --git a/project/src/Ships/Guns/LaserGun/Weapons_Beam_End.wav.import b/project/src/Ships/Guns/LaserGun/Weapons_Beam_End.wav.import new file mode 100644 index 0000000..385a8e3 --- /dev/null +++ b/project/src/Ships/Guns/LaserGun/Weapons_Beam_End.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Weapons_Beam_End.wav-32e717e3f50fe31462ca7fec1898ac4c.sample" + +[deps] + +source_file="res://src/Ships/Guns/LaserGun/Weapons_Beam_End.wav" +dest_files=[ "res://.import/Weapons_Beam_End.wav-32e717e3f50fe31462ca7fec1898ac4c.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Guns/LaserGun/Weapons_Beam_Loop.wav b/project/src/Ships/Guns/LaserGun/Weapons_Beam_Loop.wav new file mode 100644 index 0000000..c641ced Binary files /dev/null and b/project/src/Ships/Guns/LaserGun/Weapons_Beam_Loop.wav differ diff --git a/project/src/Ships/Guns/LaserGun/Weapons_Beam_Loop.wav.import b/project/src/Ships/Guns/LaserGun/Weapons_Beam_Loop.wav.import new file mode 100644 index 0000000..2aaebf1 --- /dev/null +++ b/project/src/Ships/Guns/LaserGun/Weapons_Beam_Loop.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Weapons_Beam_Loop.wav-4c1a96f95599546c8530da07ade46fd1.sample" + +[deps] + +source_file="res://src/Ships/Guns/LaserGun/Weapons_Beam_Loop.wav" +dest_files=[ "res://.import/Weapons_Beam_Loop.wav-4c1a96f95599546c8530da07ade46fd1.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=true +compress/mode=0 diff --git a/project/src/Ships/Guns/LaserGun/Weapons_Beam_Start.wav b/project/src/Ships/Guns/LaserGun/Weapons_Beam_Start.wav new file mode 100644 index 0000000..3499286 Binary files /dev/null and b/project/src/Ships/Guns/LaserGun/Weapons_Beam_Start.wav differ diff --git a/project/src/Ships/Guns/LaserGun/Weapons_Beam_Start.wav.import b/project/src/Ships/Guns/LaserGun/Weapons_Beam_Start.wav.import new file mode 100644 index 0000000..9f458b8 --- /dev/null +++ b/project/src/Ships/Guns/LaserGun/Weapons_Beam_Start.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Weapons_Beam_Start.wav-dbf8e9f3a070bc30af6d8981dadf4208.sample" + +[deps] + +source_file="res://src/Ships/Guns/LaserGun/Weapons_Beam_Start.wav" +dest_files=[ "res://.import/Weapons_Beam_Start.wav-dbf8e9f3a070bc30af6d8981dadf4208.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Guns/Projectiles/PlasmaShot.tscn b/project/src/Ships/Guns/Projectiles/PlasmaShot.tscn index b64d190..b32c1e1 100644 --- a/project/src/Ships/Guns/Projectiles/PlasmaShot.tscn +++ b/project/src/Ships/Guns/Projectiles/PlasmaShot.tscn @@ -1,15 +1,16 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://src/Ships/Guns/Projectiles/Projectile.gd" type="Script" id=1] [ext_resource path="res://assets/world/plasma_ball.png" type="Texture" id=2] [ext_resource path="res://src/VFX/Shaders/glow_sprite.shader" type="Shader" id=3] [ext_resource path="res://src/VFX/DistortionEmitter.tscn" type="PackedScene" id=4] +[ext_resource path="res://src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_01.wav" type="AudioStream" id=5] [sub_resource type="ShaderMaterial" id=1] shader = ExtResource( 3 ) shader_param/alpha_intensity_front = 0.5 shader_param/tint_front = Color( 0.972549, 0.92549, 0.92549, 1 ) -shader_param/alpha_intensity_back = 3.0 +shader_param/alpha_intensity_back = 1.39583 shader_param/tint_back = Color( 0.94902, 0.054902, 0.054902, 1 ) shader_param/blend_amount = 1.0 shader_param/fade_amount = 1.0 @@ -65,3 +66,7 @@ update_scale = false [node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] scale = Vector2( 2.47902, 2.47902 ) + +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource( 5 ) +attenuation = 0.535888 diff --git a/project/src/Ships/Guns/Projectiles/Projectile.gd b/project/src/Ships/Guns/Projectiles/Projectile.gd index 5e8b269..e89b761 100644 --- a/project/src/Ships/Guns/Projectiles/Projectile.gd +++ b/project/src/Ships/Guns/Projectiles/Projectile.gd @@ -4,6 +4,15 @@ class_name Projectile extends KinematicBody2D +const _AUDIO_SAMPLES = [ + preload("Weapons_Plasma_Shot_01.wav"), + preload("Weapons_Plasma_Shot_02.wav"), + preload("Weapons_Plasma_Shot_03.wav"), + preload("Weapons_Plasma_Shot_04.wav"), + preload("Weapons_Plasma_Shot_05.wav"), + preload("Weapons_Plasma_Shot_06.wav"), +] + export var speed := 1650.0 export var damage := 10.0 export var distortion_emitter: PackedScene @@ -18,6 +27,7 @@ onready var player := $AnimationPlayer onready var remote_transform := $DistortionTransform onready var visibility_notifier: VisibilityNotifier2D = $VisibilityNotifier2D onready var collider: CollisionShape2D = $CollisionShape2D +onready var audio: AudioStreamPlayer2D = $AudioStreamPlayer2D func _ready() -> void: @@ -49,6 +59,9 @@ func appear() -> void: ) tween.start() + audio.stream = _AUDIO_SAMPLES[randi() % _AUDIO_SAMPLES.size()] + audio.play() + func die() -> void: self.is_active = false diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_01.wav b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_01.wav new file mode 100644 index 0000000..fe81cc2 Binary files /dev/null and b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_01.wav differ diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_01.wav.import b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_01.wav.import new file mode 100644 index 0000000..f08380c --- /dev/null +++ b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_01.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Weapons_Plasma_Shot_01.wav-19aa5dfb80aee211e0242a8505200d7d.sample" + +[deps] + +source_file="res://src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_01.wav" +dest_files=[ "res://.import/Weapons_Plasma_Shot_01.wav-19aa5dfb80aee211e0242a8505200d7d.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_02.wav b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_02.wav new file mode 100644 index 0000000..e540100 Binary files /dev/null and b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_02.wav differ diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_02.wav.import b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_02.wav.import new file mode 100644 index 0000000..1041fd0 --- /dev/null +++ b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_02.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Weapons_Plasma_Shot_02.wav-60ca603482ac0d7479dd36ce8abbe398.sample" + +[deps] + +source_file="res://src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_02.wav" +dest_files=[ "res://.import/Weapons_Plasma_Shot_02.wav-60ca603482ac0d7479dd36ce8abbe398.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_03.wav b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_03.wav new file mode 100644 index 0000000..5cbdda9 Binary files /dev/null and b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_03.wav differ diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_03.wav.import b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_03.wav.import new file mode 100644 index 0000000..be04d81 --- /dev/null +++ b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_03.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Weapons_Plasma_Shot_03.wav-0b213f9e22580f7be0fff4ae33beb7cd.sample" + +[deps] + +source_file="res://src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_03.wav" +dest_files=[ "res://.import/Weapons_Plasma_Shot_03.wav-0b213f9e22580f7be0fff4ae33beb7cd.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_04.wav b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_04.wav new file mode 100644 index 0000000..3ba697d Binary files /dev/null and b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_04.wav differ diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_04.wav.import b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_04.wav.import new file mode 100644 index 0000000..f1ac1fd --- /dev/null +++ b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_04.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Weapons_Plasma_Shot_04.wav-e841366e01045cb71ba23252ae37bbdc.sample" + +[deps] + +source_file="res://src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_04.wav" +dest_files=[ "res://.import/Weapons_Plasma_Shot_04.wav-e841366e01045cb71ba23252ae37bbdc.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_05.wav b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_05.wav new file mode 100644 index 0000000..d01a2d8 Binary files /dev/null and b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_05.wav differ diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_05.wav.import b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_05.wav.import new file mode 100644 index 0000000..165355a --- /dev/null +++ b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_05.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Weapons_Plasma_Shot_05.wav-e80a2baefc32f2be9abfbc71af20ebe4.sample" + +[deps] + +source_file="res://src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_05.wav" +dest_files=[ "res://.import/Weapons_Plasma_Shot_05.wav-e80a2baefc32f2be9abfbc71af20ebe4.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_06.wav b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_06.wav new file mode 100644 index 0000000..dbf2a86 Binary files /dev/null and b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_06.wav differ diff --git a/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_06.wav.import b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_06.wav.import new file mode 100644 index 0000000..584e434 --- /dev/null +++ b/project/src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_06.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Weapons_Plasma_Shot_06.wav-08aa0680cbdb08a88aec0190a13bd3ea.sample" + +[deps] + +source_file="res://src/Ships/Guns/Projectiles/Weapons_Plasma_Shot_06.wav" +dest_files=[ "res://.import/Weapons_Plasma_Shot_06.wav-08aa0680cbdb08a88aec0190a13bd3ea.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Player/Minig_Swallow.wav b/project/src/Ships/Player/Minig_Swallow.wav new file mode 100644 index 0000000..11cfe14 Binary files /dev/null and b/project/src/Ships/Player/Minig_Swallow.wav differ diff --git a/project/src/Ships/Player/Minig_Swallow.wav.import b/project/src/Ships/Player/Minig_Swallow.wav.import new file mode 100644 index 0000000..f1092e0 --- /dev/null +++ b/project/src/Ships/Player/Minig_Swallow.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Minig_Swallow.wav-b5526468481d37b809925476131fc2b0.sample" + +[deps] + +source_file="res://src/Ships/Player/Minig_Swallow.wav" +dest_files=[ "res://.import/Minig_Swallow.wav-b5526468481d37b809925476131fc2b0.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Player/Mining_Unload.wav b/project/src/Ships/Player/Mining_Unload.wav new file mode 100644 index 0000000..80ef923 Binary files /dev/null and b/project/src/Ships/Player/Mining_Unload.wav differ diff --git a/project/src/Ships/Player/Mining_Unload.wav.import b/project/src/Ships/Player/Mining_Unload.wav.import new file mode 100644 index 0000000..fb5c643 --- /dev/null +++ b/project/src/Ships/Player/Mining_Unload.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Mining_Unload.wav-11877314e8676e182767b49cb0b5d252.sample" + +[deps] + +source_file="res://src/Ships/Player/Mining_Unload.wav" +dest_files=[ "res://.import/Mining_Unload.wav-11877314e8676e182767b49cb0b5d252.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Player/PlayerShip.tscn b/project/src/Ships/Player/PlayerShip.tscn index 6a7e03d..b366fe5 100644 --- a/project/src/Ships/Player/PlayerShip.tscn +++ b/project/src/Ships/Player/PlayerShip.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=2] +[gd_scene load_steps=25 format=2] [ext_resource path="res://src/Ships/Ship.tscn" type="PackedScene" id=1] [ext_resource path="res://src/Libraries/StateMachine/StateMachine.gd" type="Script" id=2] @@ -19,6 +19,11 @@ [ext_resource path="res://src/VFX/MoveTrail.tscn" type="PackedScene" id=17] [ext_resource path="res://src/Ships/Player/VFX.gd" type="Script" id=18] [ext_resource path="res://src/VFX/DustEmitter.tscn" type="PackedScene" id=19] +[ext_resource path="res://src/Common/LoopingAudioStreamPlayer2D.gd" type="Script" id=20] +[ext_resource path="res://src/Ships/Player/Thrust_End.wav" type="AudioStream" id=21] +[ext_resource path="res://src/Ships/Player/Thrust_Loop.wav" type="AudioStream" id=22] +[ext_resource path="res://src/Ships/Player/Thrust_Start.wav" type="AudioStream" id=23] +[ext_resource path="res://src/Ships/Player/Player_Landing.wav" type="AudioStream" id=24] [node name="PlayerShip" instance=ExtResource( 1 )] collision_mask = 14 @@ -38,9 +43,18 @@ drag_linear_coeff = 0.04 [node name="Travel" type="Node" parent="StateMachine/Move" index="0"] script = ExtResource( 4 ) +[node name="ThrustersAudioPlayer" type="AudioStreamPlayer2D" parent="StateMachine/Move/Travel" index="0"] +script = ExtResource( 20 ) +start = ExtResource( 23 ) +loop = ExtResource( 22 ) +tail = ExtResource( 21 ) + [node name="Dock" type="Node" parent="StateMachine/Move" index="1"] script = ExtResource( 5 ) +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="StateMachine/Move/Dock" index="0"] +stream = ExtResource( 24 ) + [node name="Precision" type="Node" parent="StateMachine/Move" index="2"] script = ExtResource( 7 ) diff --git a/project/src/Ships/Player/Player_Landing.wav b/project/src/Ships/Player/Player_Landing.wav new file mode 100644 index 0000000..714406b Binary files /dev/null and b/project/src/Ships/Player/Player_Landing.wav differ diff --git a/project/src/Ships/Player/Player_Landing.wav.import b/project/src/Ships/Player/Player_Landing.wav.import new file mode 100644 index 0000000..a702741 --- /dev/null +++ b/project/src/Ships/Player/Player_Landing.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Player_Landing.wav-40b160773fda5c23a07ac1d2016b799c.sample" + +[deps] + +source_file="res://src/Ships/Player/Player_Landing.wav" +dest_files=[ "res://.import/Player_Landing.wav-40b160773fda5c23a07ac1d2016b799c.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Player/States/Dock.gd b/project/src/Ships/Player/States/Dock.gd index 757b621..7a3038a 100644 --- a/project/src/Ships/Player/States/Dock.gd +++ b/project/src/Ships/Player/States/Dock.gd @@ -22,6 +22,8 @@ var _docking_phase := 0 var _current_docking_point: Node2D var _controls_disabled := false +onready var audio: AudioStreamPlayer = $AudioStreamPlayer + func _ready() -> void: yield(owner, "ready") @@ -101,7 +103,7 @@ func physics_process(delta: float) -> void: Events.connect("force_undock", self, "_on_Ship_force_undock") ship.vfx.create_ripple() ship.vfx.create_dust() - return + audio.play() func unhandled_input(event: InputEvent) -> void: diff --git a/project/src/Ships/Player/States/Travel.gd b/project/src/Ships/Player/States/Travel.gd index 5483f08..d12cfda 100644 --- a/project/src/Ships/Player/States/Travel.gd +++ b/project/src/Ships/Player/States/Travel.gd @@ -4,12 +4,19 @@ extends PlayerState var reversing := false +onready var audio_thrusters: LoopingAudioStreamPlayer2D = $ThrustersAudioPlayer func physics_process(delta: float) -> void: var movement := get_movement() reversing = movement.y > 0 var direction := GSAIUtils.angle_to_vector2(_parent.agent.orientation) + + audio_thrusters.global_position = owner.global_position + if movement.y < 0.0 and not audio_thrusters.playing: + audio_thrusters.start() + elif is_equal_approx(movement.y, 0.0) and not audio_thrusters.ending: + audio_thrusters.end() _parent.linear_velocity += ( movement.y diff --git a/project/src/Ships/Player/Thrust_End.wav b/project/src/Ships/Player/Thrust_End.wav new file mode 100644 index 0000000..b78aea6 Binary files /dev/null and b/project/src/Ships/Player/Thrust_End.wav differ diff --git a/project/src/Ships/Player/Thrust_End.wav.import b/project/src/Ships/Player/Thrust_End.wav.import new file mode 100644 index 0000000..64271c8 --- /dev/null +++ b/project/src/Ships/Player/Thrust_End.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Thrust_End.wav-745d3ce6e3033fa4768aec114ece5167.sample" + +[deps] + +source_file="res://src/Ships/Player/Thrust_End.wav" +dest_files=[ "res://.import/Thrust_End.wav-745d3ce6e3033fa4768aec114ece5167.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/Ships/Player/Thrust_Loop.wav b/project/src/Ships/Player/Thrust_Loop.wav new file mode 100644 index 0000000..217dd2e Binary files /dev/null and b/project/src/Ships/Player/Thrust_Loop.wav differ diff --git a/project/src/Ships/Player/Thrust_Loop.wav.import b/project/src/Ships/Player/Thrust_Loop.wav.import new file mode 100644 index 0000000..7e52d67 --- /dev/null +++ b/project/src/Ships/Player/Thrust_Loop.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Thrust_Loop.wav-1e39936b9ddb92aa1b47dfb246879678.sample" + +[deps] + +source_file="res://src/Ships/Player/Thrust_Loop.wav" +dest_files=[ "res://.import/Thrust_Loop.wav-1e39936b9ddb92aa1b47dfb246879678.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=true +compress/mode=0 diff --git a/project/src/Ships/Player/Thrust_Start.wav b/project/src/Ships/Player/Thrust_Start.wav new file mode 100644 index 0000000..c70099e Binary files /dev/null and b/project/src/Ships/Player/Thrust_Start.wav differ diff --git a/project/src/Ships/Player/Thrust_Start.wav.import b/project/src/Ships/Player/Thrust_Start.wav.import new file mode 100644 index 0000000..3ecb82b --- /dev/null +++ b/project/src/Ships/Player/Thrust_Start.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Thrust_Start.wav-645aa5b52079f2b2373b3fa8a8c5a904.sample" + +[deps] + +source_file="res://src/Ships/Player/Thrust_Start.wav" +dest_files=[ "res://.import/Thrust_Start.wav-645aa5b52079f2b2373b3fa8a8c5a904.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/UI/CargoProgress.gd b/project/src/UI/CargoProgress.gd index 7e0e0a9..4c0c63a 100644 --- a/project/src/UI/CargoProgress.gd +++ b/project/src/UI/CargoProgress.gd @@ -7,6 +7,7 @@ onready var arc_top := $ArcTop onready var fill := $Fill onready var tween := $Tween onready var anim_player := $AnimationPlayer +onready var audio_unload: AudioStreamPlayer = $AudioUnload var docked_position := Vector2.ZERO @@ -37,6 +38,7 @@ func spawn_ore() -> void: else: ore.global_position = rect_global_position + rect_pivot_offset ore.animate_to(docked_position) + audio_unload.play() func _on_Events_docked(docking_point: DockingPoint) -> void: diff --git a/project/src/UI/CargoProgress.tscn b/project/src/UI/CargoProgress.tscn index a3de045..a0fe80d 100644 --- a/project/src/UI/CargoProgress.tscn +++ b/project/src/UI/CargoProgress.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://src/UI/CargoProgress.gd" type="Script" id=1] [ext_resource path="res://assets/ui/cargo_interface/cargo_outer.svg" type="Texture" id=2] +[ext_resource path="res://src/Ships/Player/Mining_Unload.wav" type="AudioStream" id=3] [ext_resource path="res://assets/ui/cargo_interface/cargo_fill.svg" type="Texture" id=4] [sub_resource type="StyleBoxEmpty" id=1] @@ -97,3 +98,6 @@ stretch_mode = 6 __meta__ = { "_edit_use_anchors_": false } + +[node name="AudioUnload" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 3 ) diff --git a/project/src/VFX/Explosion/Explosion.gd b/project/src/VFX/Explosion/Explosion.gd index 2ca1ecc..bff22f0 100644 --- a/project/src/VFX/Explosion/Explosion.gd +++ b/project/src/VFX/Explosion/Explosion.gd @@ -1,10 +1,21 @@ extends Node2D +var _audio_samples := [ + preload("Explosion_01.wav"), + preload("Explosion_02.wav"), + preload("Explosion_03.wav"), + preload("Explosion_04.wav"), +] + export var Shockwave: PackedScene +onready var audio: AudioStreamPlayer2D = $AudioStreamPlayer2D + func _ready() -> void: Events.emit_signal("explosion_occurred") + audio.stream = _audio_samples[randi() % _audio_samples.size()] + var shockwave := Shockwave.instance() ObjectRegistry.register_distortion_effect(shockwave) shockwave.global_position = global_position diff --git a/project/src/VFX/Explosion/Explosion.tscn b/project/src/VFX/Explosion/Explosion.tscn index eb44b07..7ed971f 100644 --- a/project/src/VFX/Explosion/Explosion.tscn +++ b/project/src/VFX/Explosion/Explosion.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=25 format=2] +[gd_scene load_steps=26 format=2] [ext_resource path="res://assets/vfx/sparkle.png" type="Texture" id=1] [ext_resource path="res://src/VFX/Explosion/explosion_gradient_2.tres" type="Texture" id=2] @@ -7,21 +7,22 @@ [ext_resource path="res://assets/vfx/puff_smooth.png" type="Texture" id=5] [ext_resource path="res://src/VFX/Explosion/scraps_gradient.tres" type="Texture" id=6] [ext_resource path="res://src/VFX/ShockwaveEmitter.tscn" type="PackedScene" id=7] +[ext_resource path="res://src/VFX/Explosion/Explosion_01.wav" type="AudioStream" id=8] -[sub_resource type="Gradient" id=2] +[sub_resource type="Gradient" id=1] offsets = PoolRealArray( 0.0494297, 0.913043, 1 ) colors = PoolColorArray( 0.226562, 0.217086, 0.217086, 1, 0.133333, 0.12549, 0.12549, 1, 0.133333, 0.12549, 0.12549, 0 ) -[sub_resource type="GradientTexture" id=3] -gradient = SubResource( 2 ) +[sub_resource type="GradientTexture" id=2] +gradient = SubResource( 1 ) -[sub_resource type="Curve" id=4] +[sub_resource type="Curve" id=3] _data = [ Vector2( 0, 0.290223 ), 0.0, 3.6562, 0, 0, Vector2( 0.682482, 1 ), -0.0677277, -0.0677277, 0, 0, Vector2( 1, 0.554545 ), -0.29932, 0.0, 0, 0 ] -[sub_resource type="CurveTexture" id=5] -curve = SubResource( 4 ) +[sub_resource type="CurveTexture" id=4] +curve = SubResource( 3 ) -[sub_resource type="ParticlesMaterial" id=6] +[sub_resource type="ParticlesMaterial" id=5] emission_shape = 1 emission_sphere_radius = 40.0 flag_disable_z = true @@ -38,16 +39,16 @@ angle = 360.0 angle_random = 1.0 scale = 2.6 scale_random = 0.5 -scale_curve = SubResource( 5 ) -color_ramp = SubResource( 3 ) +scale_curve = SubResource( 4 ) +color_ramp = SubResource( 2 ) -[sub_resource type="Curve" id=7] +[sub_resource type="Curve" id=6] _data = [ Vector2( 0, 0.438776 ), 0.0, 0.11528, 0, 0, Vector2( 0.770073, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.336735 ), -0.564845, 0.0, 0, 0 ] -[sub_resource type="CurveTexture" id=8] -curve = SubResource( 7 ) +[sub_resource type="CurveTexture" id=7] +curve = SubResource( 6 ) -[sub_resource type="ParticlesMaterial" id=9] +[sub_resource type="ParticlesMaterial" id=8] trail_divisor = 30 emission_shape = 1 emission_sphere_radius = 15.0 @@ -65,23 +66,23 @@ damping_random = 1.0 angle_random = 1.0 scale = 0.2 scale_random = 0.2 -scale_curve = SubResource( 8 ) +scale_curve = SubResource( 7 ) color_ramp = ExtResource( 6 ) -[sub_resource type="Gradient" id=10] +[sub_resource type="Gradient" id=9] offsets = PoolRealArray( 0, 0.130909, 0.345455, 0.607273, 1 ) colors = PoolColorArray( 1, 1, 1, 1, 1, 0.648972, 0.164062, 1, 1, 0.475624, 0.136719, 1, 0.888672, 0.17704, 0.17704, 1, 0.203922, 0.203922, 0.203922, 1 ) -[sub_resource type="GradientTexture" id=11] -gradient = SubResource( 10 ) +[sub_resource type="GradientTexture" id=10] +gradient = SubResource( 9 ) -[sub_resource type="Curve" id=12] +[sub_resource type="Curve" id=11] _data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.483222, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ] -[sub_resource type="CurveTexture" id=13] -curve = SubResource( 12 ) +[sub_resource type="CurveTexture" id=12] +curve = SubResource( 11 ) -[sub_resource type="ParticlesMaterial" id=14] +[sub_resource type="ParticlesMaterial" id=13] lifetime_randomness = 1.0 emission_shape = 1 emission_sphere_radius = 50.0 @@ -94,16 +95,16 @@ radial_accel = 200.0 tangential_accel = 100.0 scale = 0.1 scale_random = 0.47 -scale_curve = SubResource( 13 ) -color_ramp = SubResource( 11 ) +scale_curve = SubResource( 12 ) +color_ramp = SubResource( 10 ) -[sub_resource type="Curve" id=15] +[sub_resource type="Curve" id=14] _data = [ Vector2( 0, 0.0409091 ), 0.0, 8.35303, 0, 0, Vector2( 0.251678, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.993289, 0.0136364 ), 0.0, 0.0, 0, 0 ] -[sub_resource type="CurveTexture" id=16] -curve = SubResource( 15 ) +[sub_resource type="CurveTexture" id=15] +curve = SubResource( 14 ) -[sub_resource type="ParticlesMaterial" id=17] +[sub_resource type="ParticlesMaterial" id=16] flag_disable_z = true spread = 180.0 gravity = Vector3( 0, 0, 0 ) @@ -119,10 +120,10 @@ angle = 220.0 angle_random = 1.0 scale = 2.0 scale_random = 0.02 -scale_curve = SubResource( 16 ) +scale_curve = SubResource( 15 ) color_ramp = ExtResource( 2 ) -[sub_resource type="Animation" id=18] +[sub_resource type="Animation" id=17] length = 4.0 step = 0.05 tracks/0/type = "value" @@ -235,6 +236,18 @@ tracks/8/keys = { "method": "queue_free" } ] } +tracks/9/type = "value" +tracks/9/path = NodePath("AudioStreamPlayer2D:playing") +tracks/9/interp = 1 +tracks/9/loop_wrap = true +tracks/9/imported = false +tracks/9/enabled = true +tracks/9/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} [node name="Explosion" type="Node2D"] z_index = 1 @@ -249,7 +262,7 @@ lifetime = 3.0 preprocess = 0.6 explosiveness = 0.6 local_coords = false -process_material = SubResource( 6 ) +process_material = SubResource( 5 ) texture = ExtResource( 3 ) [node name="Scraps" type="Node2D" parent="."] @@ -263,7 +276,7 @@ explosiveness = 0.66 randomness = 0.5 local_coords = false draw_order = 1 -process_material = SubResource( 9 ) +process_material = SubResource( 8 ) texture = ExtResource( 5 ) [node name="ScrapsParticles2D2" type="Particles2D" parent="Scraps"] @@ -276,7 +289,7 @@ explosiveness = 0.66 randomness = 0.5 local_coords = false draw_order = 1 -process_material = SubResource( 9 ) +process_material = SubResource( 8 ) texture = ExtResource( 5 ) [node name="ScrapsParticles2D3" type="Particles2D" parent="Scraps"] @@ -289,7 +302,7 @@ explosiveness = 0.66 randomness = 0.5 local_coords = false draw_order = 1 -process_material = SubResource( 9 ) +process_material = SubResource( 8 ) texture = ExtResource( 5 ) [node name="ScrapsParticles2D4" type="Particles2D" parent="Scraps"] @@ -302,7 +315,7 @@ explosiveness = 0.66 randomness = 0.5 local_coords = false draw_order = 1 -process_material = SubResource( 9 ) +process_material = SubResource( 8 ) texture = ExtResource( 5 ) [node name="ScrapsParticles2D5" type="Particles2D" parent="Scraps"] @@ -315,27 +328,32 @@ explosiveness = 0.66 randomness = 0.5 local_coords = false draw_order = 1 -process_material = SubResource( 9 ) +process_material = SubResource( 8 ) texture = ExtResource( 5 ) [node name="SparkleParticles2D" type="Particles2D" parent="."] modulate = Color( 1.5, 1.5, 1.5, 1 ) +emitting = false amount = 32 explosiveness = 0.2 randomness = 1.0 -process_material = SubResource( 14 ) +process_material = SubResource( 13 ) texture = ExtResource( 1 ) [node name="FireBallParticles2D" type="Particles2D" parent="."] modulate = Color( 1.1, 1.1, 1.1, 1 ) +emitting = false amount = 64 lifetime = 0.5 randomness = 1.0 local_coords = false draw_order = 1 -process_material = SubResource( 17 ) +process_material = SubResource( 16 ) texture = ExtResource( 3 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="."] autoplay = "Explode" -anims/Explode = SubResource( 18 ) +anims/Explode = SubResource( 17 ) + +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource( 8 ) diff --git a/project/src/VFX/Explosion/Explosion_01.wav b/project/src/VFX/Explosion/Explosion_01.wav new file mode 100644 index 0000000..deb75a6 Binary files /dev/null and b/project/src/VFX/Explosion/Explosion_01.wav differ diff --git a/project/src/VFX/Explosion/Explosion_01.wav.import b/project/src/VFX/Explosion/Explosion_01.wav.import new file mode 100644 index 0000000..7588796 --- /dev/null +++ b/project/src/VFX/Explosion/Explosion_01.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Explosion_01.wav-1a7692bcda7d1cb477249946be298b4c.sample" + +[deps] + +source_file="res://src/VFX/Explosion/Explosion_01.wav" +dest_files=[ "res://.import/Explosion_01.wav-1a7692bcda7d1cb477249946be298b4c.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/VFX/Explosion/Explosion_02.wav b/project/src/VFX/Explosion/Explosion_02.wav new file mode 100644 index 0000000..a200bee Binary files /dev/null and b/project/src/VFX/Explosion/Explosion_02.wav differ diff --git a/project/src/VFX/Explosion/Explosion_02.wav.import b/project/src/VFX/Explosion/Explosion_02.wav.import new file mode 100644 index 0000000..23029b5 --- /dev/null +++ b/project/src/VFX/Explosion/Explosion_02.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Explosion_02.wav-ee4f1d9191a0065d630b3b873894954f.sample" + +[deps] + +source_file="res://src/VFX/Explosion/Explosion_02.wav" +dest_files=[ "res://.import/Explosion_02.wav-ee4f1d9191a0065d630b3b873894954f.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/VFX/Explosion/Explosion_03.wav b/project/src/VFX/Explosion/Explosion_03.wav new file mode 100644 index 0000000..30a02fd Binary files /dev/null and b/project/src/VFX/Explosion/Explosion_03.wav differ diff --git a/project/src/VFX/Explosion/Explosion_03.wav.import b/project/src/VFX/Explosion/Explosion_03.wav.import new file mode 100644 index 0000000..880db59 --- /dev/null +++ b/project/src/VFX/Explosion/Explosion_03.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Explosion_03.wav-4b979397d4e2409bb0243122e4ab5ebc.sample" + +[deps] + +source_file="res://src/VFX/Explosion/Explosion_03.wav" +dest_files=[ "res://.import/Explosion_03.wav-4b979397d4e2409bb0243122e4ab5ebc.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/VFX/Explosion/Explosion_04.wav b/project/src/VFX/Explosion/Explosion_04.wav new file mode 100644 index 0000000..af9e2d9 Binary files /dev/null and b/project/src/VFX/Explosion/Explosion_04.wav differ diff --git a/project/src/VFX/Explosion/Explosion_04.wav.import b/project/src/VFX/Explosion/Explosion_04.wav.import new file mode 100644 index 0000000..7b047fb --- /dev/null +++ b/project/src/VFX/Explosion/Explosion_04.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Explosion_04.wav-c12897898aa928c7b1d2eaf3d8087672.sample" + +[deps] + +source_file="res://src/VFX/Explosion/Explosion_04.wav" +dest_files=[ "res://.import/Explosion_04.wav-c12897898aa928c7b1d2eaf3d8087672.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/World/DockingPoint/Asteroid.tscn b/project/src/World/DockingPoint/Asteroid.tscn index 8dba147..55c3c5d 100644 --- a/project/src/World/DockingPoint/Asteroid.tscn +++ b/project/src/World/DockingPoint/Asteroid.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://src/World/DockingPoint/DockingPoint.tscn" type="PackedScene" id=1] [ext_resource path="res://src/World/DockingPoint/Asteroid.gd" type="Script" id=2] [ext_resource path="res://assets/world/asteroid-round.svg" type="Texture" id=3] +[ext_resource path="res://src/World/DockingPoint/Minig_DigUp.wav" type="AudioStream" id=4] [sub_resource type="CircleShape2D" id=1] radius = 117.956 @@ -35,7 +36,7 @@ func _ready() -> void: playback_speed = rand_range(0.5, 2.0) " -[sub_resource type="Animation" id=6] +[sub_resource type="Animation" id=5] resource_name = "pulse" length = 0.3 step = 0.05 @@ -51,6 +52,21 @@ tracks/0/keys = { "update": 0, "values": [ Vector2( 0.449401, 0.449401 ), Vector2( 0.505533, 0.505533 ), Vector2( 0.449401, 0.449401 ) ] } +tracks/1/type = "value" +tracks/1/path = NodePath("AudioStreamPlayer:playing") +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 ] +} + +[sub_resource type="AudioStreamRandomPitch" id=6] +audio_stream = ExtResource( 4 ) [node name="Asteroid" instance=ExtResource( 1 )] script = ExtResource( 2 ) @@ -73,6 +89,9 @@ anims/spin = SubResource( 3 ) script = SubResource( 4 ) [node name="FXAnimationPlayer" type="AnimationPlayer" parent="." index="7"] -anims/pulse = SubResource( 6 ) +anims/pulse = SubResource( 5 ) [node name="FXTween" type="Tween" parent="." index="8"] + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="." index="9"] +stream = SubResource( 6 ) diff --git a/project/src/World/DockingPoint/Minig_DigUp.wav b/project/src/World/DockingPoint/Minig_DigUp.wav new file mode 100644 index 0000000..0ecae67 Binary files /dev/null and b/project/src/World/DockingPoint/Minig_DigUp.wav differ diff --git a/project/src/World/DockingPoint/Minig_DigUp.wav.import b/project/src/World/DockingPoint/Minig_DigUp.wav.import new file mode 100644 index 0000000..1b1daec --- /dev/null +++ b/project/src/World/DockingPoint/Minig_DigUp.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/Minig_DigUp.wav-ff02a0b0f9aff083ab0b7c8fd160a391.sample" + +[deps] + +source_file="res://src/World/DockingPoint/Minig_DigUp.wav" +dest_files=[ "res://.import/Minig_DigUp.wav-ff02a0b0f9aff083ab0b7c8fd160a391.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=true +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/project/src/World/Ores/IronOre.gd b/project/src/World/Ores/IronOre.gd index 07575c9..ba8a2a9 100644 --- a/project/src/World/Ores/IronOre.gd +++ b/project/src/World/Ores/IronOre.gd @@ -1,6 +1,7 @@ extends Sprite onready var tween := $Tween +onready var audio: AudioStreamPlayer = $AudioStreamPlayer func _init() -> void: @@ -34,6 +35,11 @@ func animate_to(target_position: Vector2) -> void: Tween.EASE_OUT, 0.4 + random_delay ) + tween.start() + scale = Vector2.ZERO + yield(get_tree().create_timer(random_delay), "timeout") + visible = true + yield(tween, "tween_all_completed") tween.interpolate_property( self, "scale", @@ -41,13 +47,10 @@ func animate_to(target_position: Vector2) -> void: Vector2.ZERO, 0.25, Tween.TRANS_BACK, - Tween.EASE_IN, - 0.85 + random_delay + Tween.EASE_IN ) + audio.play() tween.start() - scale = Vector2.ZERO - yield(get_tree().create_timer(random_delay), "timeout") - visible = true yield(tween, "tween_all_completed") queue_free() diff --git a/project/src/World/Ores/IronOre.tscn b/project/src/World/Ores/IronOre.tscn index 5a36257..e8dc9a2 100644 --- a/project/src/World/Ores/IronOre.tscn +++ b/project/src/World/Ores/IronOre.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://assets/world/iron_ore.svg" type="Texture" id=1] [ext_resource path="res://src/World/Ores/IronOre.gd" type="Script" id=2] +[ext_resource path="res://src/Ships/Player/Minig_Swallow.wav" type="AudioStream" id=3] [node name="IronOre" type="Sprite"] scale = Vector2( 0.3, 0.3 ) @@ -9,3 +10,6 @@ texture = ExtResource( 1 ) script = ExtResource( 2 ) [node name="Tween" type="Tween" parent="."] + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 3 )