add level 2 music #18
BIN
godot/assets/music/level2.ogg
(Stored with Git LFS)
Normal file
BIN
godot/assets/music/level2.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
15
godot/assets/music/level2.ogg.import
Normal file
15
godot/assets/music/level2.ogg.import
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="ogg_vorbis"
|
||||||
|
type="AudioStreamOGGVorbis"
|
||||||
|
path="res://.import/level2.ogg-0cba17639fcb1c4e45dc4f01c5837760.oggstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/music/level2.ogg"
|
||||||
|
dest_files=[ "res://.import/level2.ogg-0cba17639fcb1c4e45dc4f01c5837760.oggstr" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=true
|
||||||
|
loop_offset=0
|
@ -1,9 +1,11 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://CameraLimit.gdns" type="Script" id=1]
|
[ext_resource path="res://CameraLimit.gdns" type="Script" id=1]
|
||||||
[ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://assets/backgrounds/hills.png" type="Texture" id=3]
|
[ext_resource path="res://assets/backgrounds/hills.png" type="Texture" id=3]
|
||||||
[ext_resource path="res://levels/Level2.tmx" type="PackedScene" id=4]
|
[ext_resource path="res://levels/Level2.tmx" type="PackedScene" id=4]
|
||||||
|
[ext_resource path="res://assets/music/level2.ogg" type="AudioStream" id=5]
|
||||||
|
[ext_resource path="res://levels/MusicPlayer.gd" type="Script" id=6]
|
||||||
|
|
||||||
[node name="Level2" type="Node2D"]
|
[node name="Level2" type="Node2D"]
|
||||||
|
|
||||||
@ -39,3 +41,8 @@ centered = false
|
|||||||
|
|
||||||
[node name="Level2" parent="Map" instance=ExtResource( 4 )]
|
[node name="Level2" parent="Map" instance=ExtResource( 4 )]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
|
pause_mode = 2
|
||||||
|
stream = ExtResource( 5 )
|
||||||
|
script = ExtResource( 6 )
|
||||||
|
16
godot/levels/MusicPlayer.gd
Normal file
16
godot/levels/MusicPlayer.gd
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
extends AudioStreamPlayer
|
||||||
|
|
||||||
|
|
||||||
|
# there is currently a bug with AudioStreamPlayer
|
||||||
|
# it doesn't pause when the tree is paused
|
||||||
|
# so let's manually check if paused and pause the audio
|
||||||
|
# for this to work pause mode for the node is set to process instead of inherit
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(_delta: float) -> void:
|
||||||
|
if get_tree().paused and playing:
|
||||||
|
stop()
|
||||||
|
playing = false
|
||||||
|
elif not get_tree().paused and not playing:
|
||||||
|
play()
|
||||||
|
playing = true
|
Loading…
Reference in New Issue
Block a user