
function init(bIsRestart)

	-- initialise level
	init_level("level-fake-ending", CCPoint(-7.5, -29), bIsRestart)

	if (bIsRestart ~= true) then

		-- Start cut scene
		startCutScene(bIsRestart)		
	end

	-- preload descriptors
	game_manager:actorDescWithFile("lumberjack-concerned.plist")

    -- preload sfx
   	game_manager:getSFXManager():preloadSFX("sfx/timeline-catchup.mp3");
    
	-- TESTING CAMERA SETUP STUFF
--[[
	local camera_manager = game_manager.CameraManager;
	camera_manager.GameScale.Target = 2;
	camera_manager.CameraCenterHeight.Target = -15;
]]--

end

-- After Intro has loaded
function startCutScene(bIsRestart)

	if (bIsRestart ~= true) then
		-- Restart from here
	 	game_manager:setCheckpoint("startCutScene");
	end

	local backdrop = game_manager.Background
	local camera_target = backdrop:getNodeByName("cameraTarget")
	camera_manager:setTarget(camera_target)

	-- Fade in from white
	hud:doScreenFade(ccc4(255,255,255,255), 0)
	hud:doScreenFade(ccc4(0,0,0,0), 0.5)

	-- Wave 
	player:doActionByName("Wave")
	player:disconnectInputSignals()
	player:setFacingDir(kFacingDir_Right)

	-- Show the location (after we've waited for the camera to pan over)
	game_manager:startTimer(4, doDisplayLocation);

	return true

end

-- Show time & location bar
function doDisplayLocation()

	hud:showTimeAndLocation(localize("TIME_PRESENT_DAY"), localize("PLACE_TIM_BURRS_HOUSE"), 3, sayHelloTim);

end

function sayHelloTim()

    hud:playSpeech("lumberjack", localize("FAKE_ENDING_1"), speech_duration);
    hud:playSpeech("lumberjack", localize("FAKE_ENDING_2"), speech_duration)
    hud:playSpeech("lumberjack", localize("FAKE_ENDING_3"), speech_duration)

    hud:playSpeech("lumberjack", localize("FAKE_ENDING_4"), speech_duration - 1, 
    	function() player:doActionByName("Concerned") end)

	hud:playSpeech("lumberjack", localize("FAKE_ENDING_5"), speech_duration)
	hud:playSpeech("fist", localize("FAKE_ENDING_6"), speech_duration, fistTalk)

	hud:playSpeech("lumberjack", localize("FAKE_ENDING_7"), speech_duration, talkToFistScared)

	hud:playSpeech("fist", localize("FAKE_ENDING_8"), speech_duration, fistTalk)

	hud:playSpeech("lumberjack", localize("FAKE_ENDING_9"), speech_duration, talkToFistScared)
	hud:playSpeech("lumberjack", localize("FAKE_ENDING_10"), speech_duration, talkToFist, startShake)

    hud:playSpeech("lumberjack", localize("FAKE_ENDING_11"), speech_duration);
    hud:playSpeech("fist", localize("FAKE_ENDING_12"), speech_duration, fistTalk, nextLevel);

end

function startShake()

	game_manager:startTimer(5.5, doShake, true)
--   	game_manager:startTimer(2.0, sayWhaaaa)
--   	game_manager:startTimer(5.0, function() hud:doScreenFade(ccc4(255,255,255,255), 0.5) end)
--	game_manager:startTimer(6.0, nextLevel)
  	game_manager:getSFXManager():playSFX("sfx/timeline-catchup.mp3")

end

function doShake(progress)
		
	game_manager.CameraManager.ShakeScale = progress

end		
	
function sayWhaaaa()
	
	local player = game_manager.Player

	player:doActionByName("Concerned");
	hud:playSpeech("fist", "I don't think the plan worked.", speech_duration - 1, fistTalk);

end