2.15 introducing audio
This commit is contained in:
parent
e7c63127dc
commit
9f8a76b98b
6 changed files with 56 additions and 4 deletions
BIN
resources/audio/SFX - Death Explosion.ogg
Normal file
BIN
resources/audio/SFX - Death Explosion.ogg
Normal file
Binary file not shown.
19
resources/audio/SFX - Death Explosion.ogg.import
Normal file
19
resources/audio/SFX - Death Explosion.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://nsq05kpsix83"
|
||||
path="res://.godot/imported/SFX - Death Explosion.ogg-06afa3d35e6199e40d450ea43745acae.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://resources/audio/SFX - Death Explosion.ogg"
|
||||
dest_files=["res://.godot/imported/SFX - Death Explosion.ogg-06afa3d35e6199e40d450ea43745acae.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
beat_count=0
|
||||
bar_beats=4
|
BIN
resources/audio/SFX - Success.ogg
Normal file
BIN
resources/audio/SFX - Success.ogg
Normal file
Binary file not shown.
19
resources/audio/SFX - Success.ogg.import
Normal file
19
resources/audio/SFX - Success.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://cr4ckjeqxa5xe"
|
||||
path="res://.godot/imported/SFX - Success.ogg-034dffdc75a9484e2edb7f141a6c8f27.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://resources/audio/SFX - Success.ogg"
|
||||
dest_files=["res://.godot/imported/SFX - Success.ogg-034dffdc75a9484e2edb7f141a6c8f27.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -10,8 +10,13 @@ public partial class Player : RigidBody3D
|
|||
private Vector3 ZLeft;
|
||||
private Vector3 ZRight;
|
||||
|
||||
private AudioStreamPlayer deathAudioPlayer;
|
||||
private AudioStreamPlayer successAudioPlayer;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
deathAudioPlayer = GetNode<AudioStreamPlayer>("DeathAudioPlayer");
|
||||
successAudioPlayer = GetNode<AudioStreamPlayer>("SuccessAudioPlayer");
|
||||
BodyEntered += OnPlayerCollision;
|
||||
ZLeft = new Vector3(0, 0, torque);
|
||||
ZRight = new Vector3(0, 0, -torque);
|
||||
|
@ -44,17 +49,18 @@ public partial class Player : RigidBody3D
|
|||
}
|
||||
|
||||
private void CrashSequence(){
|
||||
deathAudioPlayer.Play();
|
||||
Tween tween = CreateTween();
|
||||
tween.TweenInterval(1.0);
|
||||
tween.TweenInterval(2.5);
|
||||
tween.TweenCallback(Callable.From(() => DeferredCalls.ReloadCurrentScene(this)));
|
||||
SetProcess(false);
|
||||
BodyEntered -= OnPlayerCollision;
|
||||
}
|
||||
|
||||
private void CompleteLevel(string nextLevel){
|
||||
successAudioPlayer.Play();
|
||||
Tween tween = CreateTween();
|
||||
tween.TweenInterval(1.0);
|
||||
tween.TweenInterval(2.3);
|
||||
tween.TweenCallback(Callable.From(() => DeferredCalls.ChangeSceneToFile(this, nextLevel)));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cuduv6fwqtocs"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cuduv6fwqtocs"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/characters/Player.cs" id="1_fr1bo"]
|
||||
[ext_resource type="AudioStream" uid="uid://nsq05kpsix83" path="res://resources/audio/SFX - Death Explosion.ogg" id="2_ml1je"]
|
||||
[ext_resource type="AudioStream" uid="uid://cr4ckjeqxa5xe" path="res://resources/audio/SFX - Success.ogg" id="3_xmihe"]
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_dk8lw"]
|
||||
|
||||
|
@ -21,3 +23,9 @@ mesh = SubResource("CylinderMesh_dk8lw")
|
|||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CylinderShape3D_bplwn")
|
||||
|
||||
[node name="DeathAudioPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_ml1je")
|
||||
|
||||
[node name="SuccessAudioPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_xmihe")
|
||||
|
|
Loading…
Add table
Reference in a new issue