Let there be some sound. And resources!

This commit is contained in:
Nitsud Yarg 2024-05-27 23:24:32 -07:00
parent 173b8cc67c
commit f5c12c683b
12 changed files with 121 additions and 1 deletions

View File

@ -1,7 +1,9 @@
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=19 format=2]
[ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=1]
[ext_resource path="res://src/playerC/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://assets/Tiles/Assets/Assets.png" type="Texture" id=3]
[ext_resource path="res://assets/Music/platformer_level03_loop.ogg" type="AudioStream" id=4]
[ext_resource path="res://src/CameraControl-Position2D.gd" type="Script" id=5]
[sub_resource type="ConvexPolygonShape2D" id=2]
@ -133,6 +135,17 @@ b = Vector2( -1, 349 )
[node name="Main" type="Node2D"]
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
scroll_base_scale = Vector2( 0.4, 1 )
scroll_limit_end = Vector2( 1300, 0 )
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
motion_mirroring = Vector2( 500, 0 )
[node name="Bgmuck" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
texture = ExtResource( 1 )
centered = false
[node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource( 1 )
cell_size = Vector2( 16, 16 )
@ -188,3 +201,6 @@ shape = SubResource( 13 )
[node name="CollisionShape2D2" type="CollisionShape2D" parent="CameraBoundaries"]
position = Vector2( 1281, 68 )
shape = SubResource( 13 )
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/bgmuck.png-d4be388271ba394d1ddbac361f6ed992.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Backgrounds/bgmuck.png"
dest_files=[ "res://.import/bgmuck.png-d4be388271ba394d1ddbac361f6ed992.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

View File

@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/platformer_level03_loop.ogg-eb8ec48736a59637eb7f6b57e14483e5.oggstr"
[deps]
source_file="res://assets/Music/platformer_level03_loop.ogg"
dest_files=[ "res://.import/platformer_level03_loop.ogg-eb8ec48736a59637eb7f6b57e14483e5.oggstr" ]
[params]
loop=true
loop_offset=0

Binary file not shown.

View File

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/crappy pew.wav-617183b0efcd1daa3d0b0a4a6f318332.sample"
[deps]
source_file="res://assets/Sounds/crappy pew.wav"
dest_files=[ "res://.import/crappy pew.wav-617183b0efcd1daa3d0b0a4a6f318332.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=1
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -17,9 +17,17 @@ onready var player_hurtbox = $Hurtbox_Component/CollisionShape2D
onready var gun = $Gun
onready var sound_effect_player = $AudioStreamPlayer
var sound_effects = preload("res://src/playerC/resources/sound_effects.tres")
func _ready() -> void:
movement_state_machine.init_animated_actor(self, movement_animations, player_move_component)
player_move_component.player_number = player_number
sound_effect_player.stream = sound_effects.sounds["pew"]
#print(sounds.sounds["pew"])
#sound_effects.play()
func _unhandled_input(event: InputEvent) -> void:
movement_state_machine.process_input(event)
@ -72,3 +80,5 @@ func shoot_projectile():
var is_shooting = false
is_shooting = gun.shoot(direction.x)
func play_sound():
sound_effects.stream = "res://assets/Sounds/crappy pew.wav"

View File

@ -512,3 +512,5 @@ one_shot = true
points = PoolVector2Array( -5, 0, 5, 0 )
width = 2.0
default_color = Color( 1, 0.607843, 0, 1 )
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]

View File

@ -0,0 +1,3 @@
[gd_resource type="AudioStreamSample" format=2]
[resource]

View File

@ -0,0 +1,14 @@
[gd_resource type="Resource" load_steps=2 format=2]
[sub_resource type="GDScript" id=1]
script/source = "extends Resource
var sounds = {
\"pew\": preload(\"res://assets/Sounds/crappy pew.wav\") # for firing maybe
}
"
[resource]
script = SubResource( 1 )

View File

@ -20,6 +20,8 @@ func enter() -> void:
if modifier_stack_ref.has($"../attack") == false:
$"../attack".enter()
modifier_stack_ref.push_front($"../attack")
##TODO: Hacky, don't do it this way.
parent.sound_effect_player.play()
func process_input(_event: InputEvent) -> State:
if move_component.wants_jump() and parent.is_on_floor():