TitleScene = Object.extend(Object) function TitleScene:new() end function TitleScene:init() logoWidth = gameLogo:getWidth() logoHeight = gameLogo:getHeight() progressDelta = 0 progressTarget = 0.5 percentage = 0 introSound:play() state = "in" end function TitleScene:update(dt) if progressDelta < progressTarget then progressDelta = math.min( progressTarget, progressDelta + dt ) end percentage = (progressDelta/progressTarget) if state == "in" and progressDelta == progressTarget then state = "wait" progressDelta = 0 progressTarget = 3 percentage = 0 end if state == "wait" and progressDelta == progressTarget then state = "out" progressDelta = 0 progressTarget = 0.5 percentage = 0 end if state == "out" and progressDelta == progressTarget then state = "complete" end if state == "complete" then currentScene = GameScene end end function TitleScene:draw() if state == "in" then logoAlpha = percentage logoYpos = ( (windowHeight - logoHeight) / 2 ) + ( 10 * (1-percentage) ) elseif state == "wait" then logoAlpha = 1 logoYpos = ( (windowHeight - logoHeight) / 2 ) elseif state == "out" then logoAlpha = 1 - percentage logoYpos = ( (windowHeight - logoHeight) / 2 ) - ( 20 * (percentage) ) end love.graphics.setColor(255,255,255, logoAlpha) love.graphics.draw(gameLogo, (windowWidth - logoWidth) / 2, logoYpos ) end function TitleScene:drawHud() end function TitleScene:keypressed(key,unicode) end