bullet casing sound

This commit is contained in:
pennyrigate 2024-06-25 22:49:28 -04:00
parent 940a03acec
commit f7c60470a2
7 changed files with 53 additions and 3 deletions

BIN
audio/sounds/cop_shoot.ogg Normal file

Binary file not shown.

View file

@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/cop_shoot.ogg-9b313ebb8fdaa01b18fd3850d015564e.oggstr"
[deps]
source_file="res://audio/sounds/cop_shoot.ogg"
dest_files=[ "res://.import/cop_shoot.ogg-9b313ebb8fdaa01b18fd3850d015564e.oggstr" ]
[params]
loop=false
loop_offset=0

BIN
audio/sounds/shell.ogg Normal file

Binary file not shown.

View file

@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/shell.ogg-33573c264b05fde91faa4b27d4763823.oggstr"
[deps]
source_file="res://audio/sounds/shell.ogg"
dest_files=[ "res://.import/shell.ogg-33573c264b05fde91faa4b27d4763823.oggstr" ]
[params]
loop=false
loop_offset=0

View file

@ -61,6 +61,7 @@ const a_copsquash = preload("res://audio/sounds/copsquash.ogg")
const a_copsquash2 = preload("res://audio/sounds/cop_splat.ogg") const a_copsquash2 = preload("res://audio/sounds/cop_splat.ogg")
const a_fami_transform = preload("res://audio/sounds/fami_transform.ogg") const a_fami_transform = preload("res://audio/sounds/fami_transform.ogg")
const a_ominous = preload("res://audio/sounds/ominous.ogg") const a_ominous = preload("res://audio/sounds/ominous.ogg")
const a_bullet_casing = preload("res://audio/sounds/shell.ogg")
var loop_section = null var loop_section = null
var has_looped = false var has_looped = false

View file

@ -0,0 +1,12 @@
extends RigidBody2D
var has_played_sound = false
func _on_BoneParticle_body_entered(body):
if !has_played_sound:
Audio.play_sound(Audio.a_bullet_casing, Audio.ac_climb)
has_played_sound = true

View file

@ -1,16 +1,20 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://graphics/particles/bullet_casing.png" type="Texture" id=1] [ext_resource path="res://graphics/particles/bullet_casing.png" type="Texture" id=1]
[ext_resource path="res://objects/enemy/bullet_casing.gd" type="Script" id=2]
[sub_resource type="PhysicsMaterial" id=4] [sub_resource type="PhysicsMaterial" id=4]
bounce = 0.75 bounce = 0.5
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 1, 1.5 ) extents = Vector2( 1, 1.5 )
[node name="BoneParticle" type="RigidBody2D"] [node name="BoneParticle" type="RigidBody2D"]
collision_layer = 16 collision_layer = 17
physics_material_override = SubResource( 4 ) physics_material_override = SubResource( 4 )
contacts_reported = 1
contact_monitor = true
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."] [node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 ) texture = ExtResource( 1 )
@ -21,3 +25,6 @@ shape = SubResource( 3 )
__meta__ = { __meta__ = {
"_edit_group_": true "_edit_group_": true
} }
[connection signal="body_entered" from="." to="." method="_on_BoneParticle_body_entered"]
[connection signal="body_shape_entered" from="." to="." method="_on_BoneParticle_body_shape_entered"]