feat: added drone sound effect to enemies
This commit is contained in:
		
							parent
							
								
									52cd856992
								
							
						
					
					
						commit
						3b94a7e0f3
					
				
							
								
								
									
										3
									
								
								audio/drone.aup3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								audio/drone.aup3
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:705ed551d28b1e51bf43c558e42794bc2daab145c1315a155ac9b8b8bdd893aa | ||||
| size 9003008 | ||||
|  | @ -11,7 +11,7 @@ bus/1/name = &"Artillery" | |||
| bus/1/solo = false | ||||
| bus/1/mute = false | ||||
| bus/1/bypass_fx = false | ||||
| bus/1/volume_db = 0.185026 | ||||
| bus/1/volume_db = -14.6228 | ||||
| bus/1/send = &"Master" | ||||
| bus/1/effect/0/effect = SubResource("AudioEffectLowPassFilter_i7nkl") | ||||
| bus/1/effect/0/enabled = true | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| [gd_scene load_steps=3 format=3 uid="uid://0fykl1mw3c12"] | ||||
| [gd_scene load_steps=4 format=3 uid="uid://0fykl1mw3c12"] | ||||
| 
 | ||||
| [ext_resource type="PackedScene" uid="uid://bnr6lab7heo8e" path="res://objects/character_model_base.tscn" id="1_i7aop"] | ||||
| [ext_resource type="AudioStream" uid="uid://b5evvhyrhybkf" path="res://sounds/drone.ogg" id="2_8cpm2"] | ||||
| 
 | ||||
| [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_3tduq"] | ||||
| radius = 0.370388 | ||||
|  | @ -102,4 +103,14 @@ shape = SubResource("CapsuleShape3D_3tduq") | |||
| [node name="NavigationAgent3D" type="NavigationAgent3D" parent="."] | ||||
| unique_name_in_owner = true | ||||
| 
 | ||||
| [node name="DroneSound" type="AudioStreamPlayer3D" parent="."] | ||||
| unique_name_in_owner = true | ||||
| stream = ExtResource("2_8cpm2") | ||||
| attenuation_model = 2 | ||||
| volume_db = 1.0 | ||||
| unit_size = 27.02 | ||||
| autoplay = true | ||||
| max_distance = 13.36 | ||||
| panning_strength = 0.17 | ||||
| 
 | ||||
| [editable path="CharacterModel"] | ||||
|  |  | |||
							
								
								
									
										3
									
								
								godot/sounds/drone.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								godot/sounds/drone.ogg
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | |||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:43387bbac2cc815fba70574f9637b44f359366fb1d95df78ce1d2f0fcbf010cb | ||||
| size 117501 | ||||
							
								
								
									
										19
									
								
								godot/sounds/drone.ogg.import
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								godot/sounds/drone.ogg.import
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | |||
| [remap] | ||||
| 
 | ||||
| importer="oggvorbisstr" | ||||
| type="AudioStreamOggVorbis" | ||||
| uid="uid://b5evvhyrhybkf" | ||||
| path="res://.godot/imported/drone.ogg-04eb7ed83dcda003c57d2f86862900d2.oggvorbisstr" | ||||
| 
 | ||||
| [deps] | ||||
| 
 | ||||
| source_file="res://sounds/drone.ogg" | ||||
| dest_files=["res://.godot/imported/drone.ogg-04eb7ed83dcda003c57d2f86862900d2.oggvorbisstr"] | ||||
| 
 | ||||
| [params] | ||||
| 
 | ||||
| loop=true | ||||
| loop_offset=1.0 | ||||
| bpm=0.0 | ||||
| beat_count=0 | ||||
| bar_beats=4 | ||||
|  | @ -20,6 +20,7 @@ void Enemy::_ready() { | |||
|     timer->start(this->update_interval); | ||||
|     timer->connect("timeout", callable_mp(this, &Enemy::update)); | ||||
|     this->target_rotation = this->get_rotation().y; | ||||
|     this->drone_sound = this->get_node<gd::AudioStreamPlayer3D>("%DroneSound"); | ||||
| } | ||||
| 
 | ||||
| void Enemy::_process(double delta) { | ||||
|  | @ -88,7 +89,7 @@ void Enemy::_physics_process(double delta [[maybe_unused]]) { | |||
|         basis.get_column(0) * motion.x + | ||||
|         basis.get_column(1) * motion.y + | ||||
|         basis.get_column(2) * motion.z | ||||
|     });\ | ||||
|     }); | ||||
|     this->move_and_slide(); | ||||
| } | ||||
| 
 | ||||
|  | @ -98,6 +99,7 @@ void Enemy::damage() { | |||
|     this->set_collision_layer(0x0); | ||||
| 	this->set_process(false); | ||||
| 	this->set_physics_process(false); | ||||
|     this->drone_sound->stop(); | ||||
| } | ||||
| 
 | ||||
| void Enemy::notice_player(Player *player) { | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| #include "player.hpp" | ||||
| #include "player_anim_tree.hpp" | ||||
| #include "utils/godot_macros.hpp" | ||||
| #include <godot_cpp/classes/audio_stream_player3d.hpp> | ||||
| #include <godot_cpp/classes/character_body3d.hpp> | ||||
| #include <godot_cpp/classes/navigation_agent3d.hpp> | ||||
| namespace gd = godot; | ||||
|  | @ -32,7 +33,7 @@ public: | |||
|     float get_update_interval() const; | ||||
| private: | ||||
|     int const SHOTS_BEFORE_HIT{0}; | ||||
|     float const TURN_SPEED{1.5f}; | ||||
|     float const TURN_SPEED{3.f}; | ||||
|     float const HIT_ANGLE{.05f}; | ||||
|     float const MISS_ANGLE{.2f}; | ||||
| 
 | ||||
|  | @ -46,6 +47,7 @@ private: | |||
|     Player *player{nullptr}; | ||||
|     gd::NavigationAgent3D *agent{nullptr}; | ||||
|     PlayerAnimTree *anim_tree{nullptr}; | ||||
|     gd::AudioStreamPlayer3D *drone_sound{nullptr}; | ||||
| }; | ||||
| 
 | ||||
| #endif // !ENEMY_HPP
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Sara
						Sara