diff --git a/COPYING-ART.txt b/COPYING-ART.txt index fe52e06..d72545d 100644 --- a/COPYING-ART.txt +++ b/COPYING-ART.txt @@ -1,7 +1,7 @@ All art assets are licensed under Free Culture licenses that allow (commercial) redistribution, modification, etc. -They are mostly under Creative Commons licenses, or the Public Domain. +They're mostly under Creative Commons licenses, or the Public Domain. -Each asset (under the "assets" directory) has a corresponding text-file with +Each asset (under the "art" directory) has a corresponding text-file with the author, the source URL, and licensing information. diff --git a/art/music/all.txt b/art/music/all.txt new file mode 100644 index 0000000..d1c3db8 --- /dev/null +++ b/art/music/all.txt @@ -0,0 +1,3 @@ +Author: t4ngr4m/avgvsta +Source: https://opengameart.org/content/generic-8-bit-jrpg-soundtrack +License: CC-BY 3.0 diff --git a/art/music/game.ogg b/art/music/game.ogg new file mode 100644 index 0000000..6971f25 Binary files /dev/null and b/art/music/game.ogg differ diff --git a/art/music/gameover.ogg b/art/music/gameover.ogg new file mode 100644 index 0000000..686b6fb Binary files /dev/null and b/art/music/gameover.ogg differ diff --git a/art/music/menu.ogg b/art/music/menu.ogg new file mode 100644 index 0000000..525c434 Binary files /dev/null and b/art/music/menu.ogg differ diff --git a/art/sfx/all.txt b/art/sfx/all.txt new file mode 100644 index 0000000..b3e1c47 --- /dev/null +++ b/art/sfx/all.txt @@ -0,0 +1,3 @@ +Author: shiru8bit +Source: https://opengameart.org/content/nes-8-bit-sound-effects +License: CC-BY 3.0, CC0 diff --git a/art/sfx/bounce.wav b/art/sfx/bounce.wav new file mode 100644 index 0000000..7ddb6f2 Binary files /dev/null and b/art/sfx/bounce.wav differ diff --git a/art/sfx/cpuflap.wav b/art/sfx/cpuflap.wav new file mode 100644 index 0000000..5a4d6c4 Binary files /dev/null and b/art/sfx/cpuflap.wav differ diff --git a/art/sfx/fall.wav b/art/sfx/fall.wav new file mode 100644 index 0000000..34f09d9 Binary files /dev/null and b/art/sfx/fall.wav differ diff --git a/art/sfx/flap.wav b/art/sfx/flap.wav new file mode 100644 index 0000000..487b913 Binary files /dev/null and b/art/sfx/flap.wav differ diff --git a/art/sfx/lose.wav b/art/sfx/lose.wav new file mode 100644 index 0000000..c7936f5 Binary files /dev/null and b/art/sfx/lose.wav differ diff --git a/art/sfx/pause.wav b/art/sfx/pause.wav new file mode 100644 index 0000000..c95691e Binary files /dev/null and b/art/sfx/pause.wav differ diff --git a/art/sfx/wave.wav b/art/sfx/wave.wav new file mode 100644 index 0000000..903828a Binary files /dev/null and b/art/sfx/wave.wav differ diff --git a/main.lua b/main.lua index db26f96..ac2796d 100644 --- a/main.lua +++ b/main.lua @@ -22,8 +22,13 @@ function love.load () dieParticle = nil love.graphics.setDefaultFilter("nearest", "nearest", 0) - bg = love.graphics.newImage("art/bg/sky.png") a_ttf = love.graphics.newFont("art/font/alagard.ttf", nil, "none") + bg = love.graphics.newImage("art/bg/sky.png") + bgm = nil + flapSfx = love.audio.newSource( "art/sfx/flap.wav", "static") + cpuFlapSfx = love.audio.newSource( "art/sfx/cpuflap.wav", "static") + bounceSfx = love.audio.newSource( "art/sfx/bounce.wav", "static") + waveSfx = love.audio.newSource( "art/sfx/wave.wav", "static") lifeText = love.graphics.newText(a_ttf, "Press Enter") waveText = love.graphics.newText(a_ttf, "") @@ -121,6 +126,17 @@ function mainmenu_load () bigText:set("Bats & Pray") helpScreen = false + if ( bgm ) then + bgm:stop() + end + if ( bgm ) then + bgm:stop() + end + bgm = love.audio.newSource( "art/music/menu.ogg", "static") + bgm:play() + bgm:setLooping( true ) + bgm:setVolume( 1.5 ) + p_over = nil; p_under = nil; p_bounce = nil; p_dash = nil; p_block = nil; p_bg = nil helpOver = nil; helpBounce = nil; helpDash = nil; helpBlock = nil helpScreen_setup() @@ -151,6 +167,25 @@ function mainmenu_draw () end end +-------------------- +-- INPUT +-------------------- +function mainmenu_keypressed ( key ) + if ( helpScreen == true) then + helpScreen = false + else + frontMenu:keypressed( key ) + end +end + +function mainmenu_keyreleased ( key ) + frontMenu:keyreleased( key ) +end + +-------------------- +-- HELP SCREEN +-------------------- + function helpScreen_setup () p_over = love.graphics.newImage("art/sprites/p-over.png") p_under = love.graphics.newImage("art/sprites/p-under.png") @@ -187,21 +222,6 @@ function helpScreen_draw () love.graphics.draw(helpControls, 205, 550, 0, 1.2) end --------------------- --- INPUT --------------------- -function mainmenu_keypressed ( key ) - if ( helpScreen == true) then - helpScreen = false - else - frontMenu:keypressed( key ) - end -end - -function mainmenu_keyreleased ( key ) - frontMenu:keyreleased( key ) -end - ---------------------------------------- -- PAUSE @@ -213,6 +233,10 @@ function pause_load () waveText:set("[Enter]") lifeText:set("") bigText:set("Paused") + + love.audio.pause() + sfx = love.audio.newSource( "art/sfx/pause.wav", "static") + sfx:play() end -------------------- @@ -232,6 +256,8 @@ end -------------------- function pause_keypressed ( key ) if ( key == "return" or key == "a" ) then + sfx:stop() + sfx:play() unpauseGame() elseif ( key == "escape" ) then mainmenu_load() @@ -252,6 +278,10 @@ function gameover_load () dieParticle = nil lifeText:set("Best " .. maxScore) bigText:set("Game Over") + bgm:stop() + bgm = love.audio.newSource( "art/music/gameover.ogg", "static") + bgm:play() + end -------------------- @@ -303,6 +333,9 @@ function game_load () dieParticle:setSizeVariation(1); dieParticle:setEmissionRate(0) dieParticle:setLinearAcceleration(-200, -200, 200, 200) -- Random movement in all directions. dieParticle:setSpeed(40, 50); dieParticle:setColors(1, 1, 1, 1, 1, 1, 1, 0) + +-- bgm = love.audio.newSource( "art/music/game.ogg", "static") +-- bgm:play() end -------------------- @@ -473,6 +506,12 @@ function Flier:physics_y ( dt ) if ( self.flying > 0 ) then self.y_vel = -200 self.flying = self.flying - 1 + if ( self.species ) then + love.audio.play(cpuFlapSfx) + else + flapSfx:stop() + flapSfx:play() + end end -- gravity @@ -531,6 +570,13 @@ function Flier:kill ( murderer ) dieParticle:moveTo( self.x, self.y ) dieParticle:emit( 30 ) + + if ( self.species ) then + sfx = love.audio.newSource( "art/sfx/fall.wav", "static") + else + sfx = love.audio.newSource( "art/sfx/lose.wav", "static") + end + sfx:play() end -- run after Flier falls through screen @@ -723,6 +769,8 @@ function nextWave ( ) maxScore = wave end + love.audio.play(waveSfx) + bird_n = wave * 3 for i = 1,bird_n do @@ -737,13 +785,15 @@ end -- assuming a and b are colliding, act accordingly -- aka, bounce-back or kill one function judgeCollision ( a, b ) - if ( a.y < b.y - 9 and ( a.living or a.class() == "Bat" ) ) then + if ( a.y < b.y - 9 and ( b.living ) and ( a.living or a.class() == "Bat" ) ) then b:kill( a ) - elseif ( a.y > b.y + 9 and ( b.living or a.class() == "Bat" ) ) then + elseif ( a.y > b.y + 9 and ( a.living ) and ( b.living or a.class() == "Bat" ) ) then a:kill( b ) elseif ( a.living and b.living ) then a.x_vel = a.x_vel * -1 b.x_vel = b.x_vel * -1 + bounceSfx:stop() + bounceSfx:play() end end @@ -753,6 +803,7 @@ end function unpauseGame () mode = game + love.audio.play(bgm) waveText:set( "Wave " .. wave ) lifeText:set( "Lives " .. lives ) bigText:set( "" )