Browse Source

Fixes to audio files for builds.

master
Cidney Hamilton 1 year ago
parent
commit
3b99d05d31
  1. 15
      assets/audio/game_loop.ogg.import
  2. 0
      assets/audio/music/game_loop.ogg
  3. 15
      assets/audio/music/game_loop.ogg.import
  4. 0
      assets/audio/music/title_loop.ogg
  5. 15
      assets/audio/music/title_loop.ogg.import
  6. 15
      assets/audio/title_loop.ogg.import
  7. 2
      scenes/Lagoon.tscn
  8. 14
      scenes/Main.tscn
  9. 10
      scripts/Main.gd
  10. 23
      scripts/audio/Music.gd
  11. 20
      scripts/audio/Sounds.gd
  12. 6
      scripts/ui/Cursor.gd
  13. 4
      scripts/ui/Title.gd

15
assets/audio/game_loop.ogg.import

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

0
assets/audio/game_loop.ogg → assets/audio/music/game_loop.ogg

15
assets/audio/music/game_loop.ogg.import

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

0
assets/audio/title_loop.ogg → assets/audio/music/title_loop.ogg

15
assets/audio/music/title_loop.ogg.import

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

15
assets/audio/title_loop.ogg.import

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

2
scenes/Lagoon.tscn

@ -10,6 +10,8 @@
[ext_resource path="res://assets/audio/gameover.wav" type="AudioStream" id=8]
[ext_resource path="res://assets/WaterAnimation.png" type="Texture" id=9]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 9 )
region = Rect2( 0, 0, 160, 90 )

14
scenes/Main.tscn

@ -1,8 +1,8 @@
[gd_scene load_steps=13 format=2]
[gd_scene load_steps=17 format=2]
[ext_resource path="res://scenes/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/Lagoon.tscn" type="PackedScene" id=2]
[ext_resource path="res://assets/audio/title_loop.ogg" type="AudioStream" id=3]
[ext_resource path="res://assets/audio/music/title_loop.ogg" type="AudioStream" id=3]
[ext_resource path="res://scenes/ui/Score.tscn" type="PackedScene" id=4]
[ext_resource path="res://scripts/Main.gd" type="Script" id=5]
[ext_resource path="res://scenes/ui/Title.tscn" type="PackedScene" id=6]
@ -12,6 +12,10 @@
[ext_resource path="res://scripts/audio/Sounds.gd" type="Script" id=10]
[ext_resource path="res://assets/ui/Cursor.png" type="Texture" id=11]
[ext_resource path="res://scripts/audio/Music.gd" type="Script" id=12]
[ext_resource path="res://scripts/ui/Cursor.gd" type="Script" id=13]
[ext_resource path="res://assets/audio/music/game_loop.ogg" type="AudioStream" id=14]
[ext_resource path="res://assets/audio/gameover.wav" type="AudioStream" id=15]
[ext_resource path="res://assets/audio/powerup.wav" type="AudioStream" id=16]
[node name="Main" type="Node2D"]
script = ExtResource( 5 )
@ -36,11 +40,16 @@ stream = ExtResource( 3 )
autoplay = true
bus = "Music"
script = ExtResource( 12 )
title_loop = ExtResource( 3 )
game_loop = ExtResource( 14 )
[node name="Sounds" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 9 )
bus = "Sound"
script = ExtResource( 10 )
button_press = ExtResource( 9 )
gameover = ExtResource( 15 )
powerup = ExtResource( 16 )
[node name="CursorCanvas" type="CanvasLayer" parent="."]
@ -50,3 +59,4 @@ scale = Vector2( 2, 2 )
z_index = 100
z_as_relative = false
texture = ExtResource( 11 )
script = ExtResource( 13 )

10
scripts/Main.gd

@ -20,7 +20,9 @@ signal hide_settings
signal started_speaking(line)
signal finished_speaking
signal play_music(clip)
signal play_title
signal play_game
signal play_sfx(clip)
# Global variables
@ -29,9 +31,3 @@ var saved_start_tree : bool = false
var is_game_over : bool = false
var is_first_mangrove_healed : bool = false
var islands_healed : int= 0
func _input(event):
Input.set_mouse_mode(Input.CURSOR_IBEAM)
if ($CursorCanvas/CursorSprite != null):
get_node("CursorCanvas/CursorSprite").position.x = event.position.x
get_node("CursorCanvas/CursorSprite").position.y = event.position.y

23
scripts/audio/Music.gd

@ -4,16 +4,19 @@
extends AudioStreamPlayer2D
const AUDIO_PATH = "res://assets/audio"
export var title_loop : AudioStreamOGGVorbis
export var game_loop : AudioStreamOGGVorbis
func _ready() -> void:
Main.connect("play_music", self, "play_clip")
func _ready() -> void:
Main.connect("play_title", self, "play_title")
Main.connect("play_game", self, "play_game")
# Changes the background music
func play_clip(clip_name) -> void:
var file = AUDIO_PATH + "/" + clip_name + ".ogg"
print("Switching to " + file)
if File.new().file_exists(file):
var music = load(file)
stream = music
play()
func play_title() -> void:
stream = title_loop
play()
func play_game() -> void:
stream = game_loop
play()

20
scripts/audio/Sounds.gd

@ -4,19 +4,21 @@
extends AudioStreamPlayer2D
const AUDIO_PATH = "res://assets/audio"
export var button_press : AudioStreamSample
export var gameover : AudioStreamSample
export var powerup : AudioStreamSample
func _ready() -> void:
Main.connect("play_sfx", self, "play_clip")
# Plays an arbitrary audio clip
func play_clip(clip_name) -> void:
var file = AUDIO_PATH + "/" + clip_name + ".wav"
if File.new().file_exists(file):
var sfx = load(file)
# sfx.set_loop(false)
stream = sfx
play()
func play_clip(clip) -> void:
if (clip == "button-press"):
stream = button_press
elif (clip == "gameover"):
stream = gameover
elif (clip == "powerup"):
stream = powerup
play()

6
scripts/ui/Cursor.gd

@ -0,0 +1,6 @@
extends Node2D
func _input(event):
Input.set_mouse_mode(Input.CURSOR_IBEAM)
self.position.x = event.position.x
self.position.y = event.position.y

4
scripts/ui/Title.gd

@ -37,8 +37,8 @@ func sfx() -> void:
func title_music() -> void:
print("Switch to title track.")
Main.emit_signal("play_music", "title_loop")
Main.emit_signal("play_title")
func game_music() -> void:
print("Switch to game loop track.")
Main.emit_signal("play_music", "game_loop")
Main.emit_signal("play_game")
Loading…
Cancel
Save