Added hit and coffe sfx.

This commit is contained in:
SimonLarsen 2011-05-17 21:03:40 +02:00
parent 938db12208
commit 3b5875df63
4 changed files with 24 additions and 16 deletions

View File

@ -182,22 +182,6 @@ function love.draw()
end
end
function loadResources()
imgSprites = love.graphics.newImage("gfx/sprites.png")
imgSprites:setFilter("nearest","nearest")
imgTrains = love.graphics.newImage("gfx/trains.png")
imgTrains:setFilter("nearest","nearest")
imgTerrain = love.graphics.newImage("gfx/terrain.png")
imgTerrain:setFilter("nearest","nearest")
fontimg = love.graphics.newImage("gfx/imgfont.png")
fontimg:setFilter("nearest","nearest")
imgfont = love.graphics.newImageFont(fontimg," abcdefghijklmnopqrstuvwxyz0123456789.!'-")
imgfont:setLineHeight(2)
end
function love.keypressed(key,unicode)
if key == ' ' then -- will be space most of the time
return -- avoid unnecessary checks
@ -227,3 +211,24 @@ function updateScale()
SCRNHEIGHT = HEIGHT*SCALE
love.graphics.setMode(SCRNWIDTH,SCRNHEIGHT,false)
end
function loadResources()
-- Load images
imgSprites = love.graphics.newImage("gfx/sprites.png")
imgSprites:setFilter("nearest","nearest")
imgTrains = love.graphics.newImage("gfx/trains.png")
imgTrains:setFilter("nearest","nearest")
imgTerrain = love.graphics.newImage("gfx/terrain.png")
imgTerrain:setFilter("nearest","nearest")
fontimg = love.graphics.newImage("gfx/imgfont.png")
fontimg:setFilter("nearest","nearest")
imgfont = love.graphics.newImageFont(fontimg," abcdefghijklmnopqrstuvwxyz0123456789.!'-")
imgfont:setLineHeight(2)
-- Load sound effects
auCoffee = love.audio.newSource("sfx/coffee.wav","static")
auHit = love.audio.newSource("sfx/hit.wav","static")
end

View File

@ -99,6 +99,8 @@ function Player:kill(status)
end
scrn_shake = 0.25
auHit:stop()
auHit:play()
if coffee >= 5 then
self.invul = true
@ -152,6 +154,7 @@ function Player:collideWithTrain()
train.hasCoffee = false
coffee = coffee + 1
if coffee > 5 then coffee = 5 end
auCoffee:stop() auCoffee:play()
end
end
end

BIN
sfx/coffee.wav Normal file

Binary file not shown.

BIN
sfx/hit.wav Normal file

Binary file not shown.