Created
November 7, 2012 07:04
-
-
Save kyleconroy/4029932 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Gamestate = require 'vendor/gamestate' | |
local sound = require 'vendor/TEsound' | |
local ringbuffer = require 'vendor/ringbuffer' | |
local Timer = require 'vendor/timer' | |
local state = Gamestate.new() | |
local soundtrack = ringbuffer.new( | |
'abeds-castle', | |
'abeds-town', | |
'blackcaves', | |
'blacksmith', | |
'britta-bot', | |
'credits', | |
'dancingqueen', | |
'daybreak', | |
'daylight', | |
'ending', | |
'forest', | |
'greendale-alt', | |
'greendale', | |
'level', | |
'mash-theme', | |
'opening', | |
'overworld', | |
'potionlab', | |
'rave', | |
'tavern', | |
'town', | |
'valley', | |
'village-forest' | |
) | |
function state:init() | |
end | |
function state:enter(previous) | |
sound.playMusic(soundtrack:next()) | |
Timer.addPeriodic(1, function() | |
sound.playMusic(soundtrack:next()) | |
end) | |
Timer.addPeriodic(1, function() | |
sound.playMusic(soundtrack:next()) | |
end) | |
Timer.addPeriodic(.85, function() | |
sound.playSfx('jump') | |
end) | |
Timer.addPeriodic(.85, function() | |
sound.playSfx('hippie_kill') | |
end) | |
Timer.addPeriodic(1, function() | |
print(collectgarbage('count')) | |
end) | |
end | |
function state:leave() | |
fonts.reset() | |
end | |
function state:update(dt) | |
Timer.update(dt) | |
sound.cleanup() | |
end | |
function state:keypressed( button ) | |
sound.playSfx('jump') | |
end | |
function state:draw() | |
love.graphics.setColor( 255, 255, 255, 255 ) | |
love.graphics.print( love.timer.getFPS() .. ' FPS', 50, 50, 0, 0.5, 0.5) | |
end | |
return state |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment