From e0e9d7f0739fc4c0c0e8cdc8c30ac827715db04b Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 23 Apr 2024 16:50:54 +0100 Subject: add voice over --- assets/vo/voice1.ogg | Bin 0 -> 122532 bytes assets/vo/voice2.ogg | Bin 0 -> 80802 bytes assets/vo/voice3.ogg | Bin 0 -> 76444 bytes assets/vo/voice4.ogg | Bin 0 -> 64332 bytes assets/vo/voice5.ogg | Bin 0 -> 53864 bytes assets/vo/voice6.ogg | Bin 0 -> 53378 bytes assets/vo/voice7.ogg | Bin 0 -> 16321 bytes assets/vo/voice8.ogg | Bin 0 -> 14233 bytes assets/vo/voice9.ogg | Bin 0 -> 434014 bytes level.go | 29 ++++++++++++++++++++++++----- main.go | 31 +++++++++++++++++++++++++++++-- 11 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 assets/vo/voice1.ogg create mode 100644 assets/vo/voice2.ogg create mode 100644 assets/vo/voice3.ogg create mode 100644 assets/vo/voice4.ogg create mode 100644 assets/vo/voice5.ogg create mode 100644 assets/vo/voice6.ogg create mode 100644 assets/vo/voice7.ogg create mode 100644 assets/vo/voice8.ogg create mode 100644 assets/vo/voice9.ogg diff --git a/assets/vo/voice1.ogg b/assets/vo/voice1.ogg new file mode 100644 index 0000000..80ea8c8 Binary files /dev/null and b/assets/vo/voice1.ogg differ diff --git a/assets/vo/voice2.ogg b/assets/vo/voice2.ogg new file mode 100644 index 0000000..ade567b Binary files /dev/null and b/assets/vo/voice2.ogg differ diff --git a/assets/vo/voice3.ogg b/assets/vo/voice3.ogg new file mode 100644 index 0000000..9fe3436 Binary files /dev/null and b/assets/vo/voice3.ogg differ diff --git a/assets/vo/voice4.ogg b/assets/vo/voice4.ogg new file mode 100644 index 0000000..b561e98 Binary files /dev/null and b/assets/vo/voice4.ogg differ diff --git a/assets/vo/voice5.ogg b/assets/vo/voice5.ogg new file mode 100644 index 0000000..436504e Binary files /dev/null and b/assets/vo/voice5.ogg differ diff --git a/assets/vo/voice6.ogg b/assets/vo/voice6.ogg new file mode 100644 index 0000000..f57a224 Binary files /dev/null and b/assets/vo/voice6.ogg differ diff --git a/assets/vo/voice7.ogg b/assets/vo/voice7.ogg new file mode 100644 index 0000000..8b64de7 Binary files /dev/null and b/assets/vo/voice7.ogg differ diff --git a/assets/vo/voice8.ogg b/assets/vo/voice8.ogg new file mode 100644 index 0000000..6733d7b Binary files /dev/null and b/assets/vo/voice8.ogg differ diff --git a/assets/vo/voice9.ogg b/assets/vo/voice9.ogg new file mode 100644 index 0000000..8fb2121 Binary files /dev/null and b/assets/vo/voice9.ogg differ diff --git a/level.go b/level.go index 991e1fb..5c95861 100644 --- a/level.go +++ b/level.go @@ -99,7 +99,11 @@ func StartLevel1(g *Game ) { g.state = END }) - g.QueueState(PauseScreen) + g.QueueState(func (g *Game){ + // What do you mean "is that it?". I kinda uhh ran out of time to finish the actual game but uhhh if you want I can let you have a go at finishing it for me. Just press R to reverse time and we'll go from there + PauseScreen(g) + g.audioPlayer.voiceAudio[0].Play() + }) // after end g.QueueState(func (g *Game){ g.animStart = g.time - endCardDuration @@ -115,14 +119,22 @@ func StartLevel1(g *Game ) { func StartLevel2(g *Game) { g.SetPlacing() - noMoveable(g) + //noMoveable(g) + // OK so, this level could probably be a bit more diffcult. Here's a spikey thing, just click to place it anywhere, just make sure it kills the player + g.audioPlayer.voiceAudio[1].Play() g.toPlace = append(g.toPlace, NewLeftSpike(g, 0, 0)) // after end g.QueueState(ReverseLevel) + // after reversed - g.QueueState(afterReversed) + g.QueueState(func (g *Game){ + // Nice, Good job. + // Ok right I've got another spike for you to place. Remember, you can click on things to move them around if it doesn't quite work out + g.audioPlayer.voiceAudio[2].Play() + afterReversed(g) + }) g.QueueState(StartLevel3) } @@ -130,6 +142,8 @@ func StartLevel3(g *Game) { g.SetPlacing() noMoveable(g) + //g.audioPlayer.voiceAudio[3].Play() + g.toPlace = append(g.toPlace, NewSpike(g, 0, 0)) // after end @@ -144,6 +158,8 @@ func StartLevel4(g *Game) { noMoveable(g) g.toPlace = append(g.toPlace, NewSpring(g, 0, 0)) + // Ok lets try something a bit different. here's a spring this time + g.audioPlayer.voiceAudio[4].Play() g.ClearAll() tilemap := NewTilemap([][]int{ @@ -201,11 +217,13 @@ func StartLevel4(g *Game) { g.QueueState(StartLevel5) } -// HMM maybe we can make this a bit harder, lets try moving the exit by clicking on it func StartLevel5(g *Game) { g.SetPlacing() //noMoveable(g) + // HMM thats too easy. maybe Try moving the exit ontop of the hill, that could work + g.audioPlayer.voiceAudio[5].Play() + //g.toPlace = append(g.toPlace, NewSpring(g, 0, 0)) g.exit.movable = true g.toPlace = append(g.toPlace, g.exit) @@ -218,11 +236,12 @@ func StartLevel5(g *Game) { g.QueueState(StartLevel6) } -// Ok lets add a spring there as well +// How about this? func StartLevel6(g *Game) { g.SetPlacing() //noMoveable(g) + g.audioPlayer.voiceAudio[6].Play() g.toPlace = append(g.toPlace, NewSpring(g, 0, 0)) g.toPlace = append(g.toPlace, NewRightSideSpring(g, 0, 0)) g.toPlace = append(g.toPlace, NewLeftSideSpring(g, 0, 0)) diff --git a/main.go b/main.go index bfadeb1..22dbed1 100644 --- a/main.go +++ b/main.go @@ -38,7 +38,8 @@ const ( exitTransitionWeight = 0.7 ghostAlpha = 0.5 hightlightBorder = 2 - audioFadeIn = 0.999 + audioFadeIn = 0.99 + musicVolume = 0.3 sampleRate = 44100 shadowOffset = 1 @@ -93,6 +94,21 @@ var ( //go:embed assets/land2.ogg land2Ogg_src []byte + + //go:embed assets/vo/voice1.ogg + voice1Ogg_src []byte + //go:embed assets/vo/voice2.ogg + voice2Ogg_src []byte + //go:embed assets/vo/voice3.ogg + voice3Ogg_src []byte + //go:embed assets/vo/voice4.ogg + voice4Ogg_src []byte + //go:embed assets/vo/voice5.ogg + voice5Ogg_src []byte + //go:embed assets/vo/voice6.ogg + voice6Ogg_src []byte + //go:embed assets/vo/voice7.ogg + voice7Ogg_src []byte ) var ( @@ -136,6 +152,7 @@ type AudioPlayer struct { springAudio *audio.Player jumpAudio []*audio.Player landAudio []*audio.Player + voiceAudio []*audio.Player } type Game struct { @@ -311,7 +328,7 @@ func (g *Game) Update() error { g.audioPlayer.ambientAudio.Play() } volume := g.audioPlayer.ambientAudio.Volume() - volume = 1-((1-volume)*audioFadeIn) + volume = musicVolume-((musicVolume-volume)*audioFadeIn) g.audioPlayer.ambientAudio.SetVolume(volume) } @@ -839,6 +856,16 @@ func (g *Game) LoadAudio() { g.audioPlayer.jumpAudio = loadAudiosVorbis([][]byte{jump1Ogg_src, jump2Ogg_src}, g.audioPlayer.audioContext) g.audioPlayer.landAudio = loadAudiosVorbis([][]byte{land1Ogg_src, land2Ogg_src}, g.audioPlayer.audioContext) + g.audioPlayer.voiceAudio = loadAudiosVorbis([][]byte{ + voice1Ogg_src, + voice2Ogg_src, + voice3Ogg_src, + voice4Ogg_src, + voice5Ogg_src, + voice6Ogg_src, + voice7Ogg_src, + }, g.audioPlayer.audioContext) + } func (g *Game) LoadImages() { -- cgit v1.2.1