Add music and sfx

This commit is contained in:
Stephen Seo 2023-09-30 17:07:57 +09:00
parent 7cb180c245
commit 9c7b3617c5
10 changed files with 79 additions and 2 deletions

View file

@ -29,6 +29,9 @@ var health_text_format = "%d"
var particle = preload("res://circleParticle.tscn")
@onready var hit_sfx = $HitSFX
@onready var jump_sfx = $JumpSFX
func _ready():
self_sprite.self_modulate = DEFAULT_COLOR
health_label.add_text(health_text_format % health)
@ -48,6 +51,7 @@ func _physics_process(delta):
# Handle Jump.
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
jump_sfx.play()
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
@ -83,6 +87,7 @@ func damaged(projectile):
health_label.add_text(health_text_format % health)
self_sprite.self_modulate = HURT_COLOR
hurt_timer = HURT_TIME
hit_sfx.play()
if health <= 0:
velocity = Vector2(0, 0)
collision_layer = 0

View file

@ -2,6 +2,7 @@ extends Node2D
@onready var arenaBody = $StaticBody2D
@onready var player = $CharacterBody2D
@onready var music = $AudioStreamPlayer
var projectile = preload("res://circleProjectiles.tscn")
const WAVE_TIME = 5.0
@ -43,3 +44,4 @@ func on_player_death():
button.text = "Restart?"
button.pressed.connect(do_restart)
player.add_child(button)
music.stop()

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=8 format=3 uid="uid://dsb4cupghg5of"]
[gd_scene load_steps=9 format=3 uid="uid://dsb4cupghg5of"]
[ext_resource type="Script" path="res://boxedSpace.gd" id="1_kaapg"]
[ext_resource type="Script" path="res://boundary.gd" id="2_ifihl"]
[ext_resource type="PackedScene" uid="uid://dv8hwks0xe3c0" path="res://player.tscn" id="3_b55g5"]
[ext_resource type="AudioStream" uid="uid://hyd668oirqhx" path="res://res/LD54_0.ogg" id="4_yuav8"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_usx0l"]
size = Vector2(1353, 99)
@ -44,3 +45,7 @@ position = Vector2(1203.5, 322)
shape = SubResource("RectangleShape2D_oer7k")
[node name="CharacterBody2D" parent="." instance=ExtResource("3_b55g5")]
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("4_yuav8")
autoplay = true

View file

@ -1,6 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://dv8hwks0xe3c0"]
[gd_scene load_steps=6 format=3 uid="uid://dv8hwks0xe3c0"]
[ext_resource type="Script" path="res://PlayerCharacterBody2D.gd" id="1_8l13s"]
[ext_resource type="AudioStream" uid="uid://b88dh38cr8v6o" path="res://res/jump.ogg" id="2_ix2ut"]
[ext_resource type="AudioStream" uid="uid://jfrsvixicrf" path="res://res/hit.ogg" id="3_gq63f"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yripi"]
size = Vector2(40, 40)
@ -33,3 +35,9 @@ offset_left = -61.0
offset_top = -62.0
offset_right = -21.0
offset_bottom = -22.0
[node name="JumpSFX" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_ix2ut")
[node name="HitSFX" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_gq63f")

BIN
res/LD54_0.ogg Normal file

Binary file not shown.

19
res/LD54_0.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://hyd668oirqhx"
path="res://.godot/imported/LD54_0.ogg-914c66e1067f22212958382587f3d12a.oggvorbisstr"
[deps]
source_file="res://res/LD54_0.ogg"
dest_files=["res://.godot/imported/LD54_0.ogg-914c66e1067f22212958382587f3d12a.oggvorbisstr"]
[params]
loop=true
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4

BIN
res/hit.ogg Normal file

Binary file not shown.

19
res/hit.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://jfrsvixicrf"
path="res://.godot/imported/hit.ogg-5921110b2893a050cc89cfcb36e76f19.oggvorbisstr"
[deps]
source_file="res://res/hit.ogg"
dest_files=["res://.godot/imported/hit.ogg-5921110b2893a050cc89cfcb36e76f19.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
res/jump.ogg Normal file

Binary file not shown.

19
res/jump.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://b88dh38cr8v6o"
path="res://.godot/imported/jump.ogg-d4ded6631259e8280315e620f2adb600.oggvorbisstr"
[deps]
source_file="res://res/jump.ogg"
dest_files=["res://.godot/imported/jump.ogg-d4ded6631259e8280315e620f2adb600.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4