function init(is_restart)

	-- Initialise arena - backdrop_name, start_pos, is_restart
	init_level("level-castle", CCPoint(-50, -20), is_restart)

end

function onLevelIntro()

	bot_manager.MaxBotsOnScreen = 2

	say("lumberjack", localize("CASTLE_INTRO_1"), talkToFist)
	say("fist", localize("CASTLE_INTRO_2"), fistTalk)
	say("lumberjack", localize("CASTLE_INTRO_3"), talkToFist)
	say("fist", localize("CASTLE_INTRO_4"), fistTalk)
	say("fist", localize("CASTLE_INTRO_5"), fistTalk)
	say("fist", localize("CASTLE_INTRO_6"), fistTalk)
	say("fist", localize("CASTLE_INTRO_7"), fistTalk)
	say("fist", localize("CASTLE_INTRO_8"), fistTalk)
	say("fist", localize("CASTLE_INTRO_9"), fistTalk, onLevelIntroEnd)

end

function onHeadsOnSticks()

	-- Pause player movement
	disconnectControlsAndPauseBots()

	say("fist", localize("CASTLE_STICKS_1"), fistTalk)
	say("fist", localize("CASTLE_STICKS_2"), fistTalk)
	say("lumberjack", localize("CASTLE_STICKS_3"), talkToFist)
	say("lumberjack", localize("CASTLE_STICKS_4"), talkToFist, connectControlsAndResumeBots)

	return true

end

function onDJBBQ()

	-- Pause player movement
	disconnectControlsAndPauseBots()

	say("lumberjack", localize("CASTLE_DJ_BBQ_1"))
	say("djbbq", localize("CASTLE_DJ_BBQ_2"))
	say("djbbq", localize("CASTLE_DJ_BBQ_3"))
	say("djbbq", localize("CASTLE_DJ_BBQ_4"))
	say("djbbq", localize("CASTLE_DJ_BBQ_5"))
	say("lumberjack", localize("CASTLE_DJ_BBQ_6"), nil, connectControlsAndResumeBots)

	return true

end

function onHumanTesticles()

	-- Pause player movement
	disconnectControlsAndPauseBots()

	say("lumberjack", localize("CASTLE_TESTICLES_1"), talkToFist)
	say("fist", localize("CASTLE_TESTICLES_2"), fistTalk)
	say("lumberjack", localize("CASTLE_TESTICLES_3"), talkToFist)
	say("fist", localize("CASTLE_TESTICLES_4"), fistTalk)
	say("lumberjack", localize("CASTLE_TESTICLES_5"), talkToFist, connectControlsAndResumeBots)

	return true

end

function onPicnicBaskets()

	-- Pause player movement
	disconnectControlsAndPauseBots()

	say("lumberjack", localize("CASTLE_BASKETS_1"), talkToFist)
	say("fist", localize("CASTLE_BASKETS_2"), fistTalk)
	say("lumberjack", localize("CASTLE_BASKETS_3"), talkToFist, connectControlsAndResumeBots)

	return true

end

function onAmbush(bIsRestart)

	if (bIsRestart ~= true) then

		-- Make this a bit harder than the last ambush
		bot_manager.MaxBotsOnScreen = bot_manager.MaxBotsOnScreen + 1


		-- Restart from here
		game_manager:setCheckpoint("onAmbush")
	end
                
	-- Spawn regular enemies
	local bot_descs = {}
	table.insert(bot_descs, game_manager:actorDescWithFile("peasant-gruntbear.plist"))
	table.insert(bot_descs, game_manager:actorDescWithFile("asscred-gruntbear.plist"))

	-- Spawn lots of enemies
	startAmbush(bot_descs, bot_manager.MaxBotsOnScreen * 2)

	return true
	
end

function onBossAmbush(bIsRestart)

	-- Restart from here
	game_manager:setCheckpoint("onBossAmbush")

	bot_manager.MaxBotsOnScreen = 4

	-- Spawn regular enemies
	local bot_descs = {}
	table.insert(bot_descs, game_manager:actorDescWithFile("asscred-gruntbear.plist"))
	boss_id = startLevelBossFight("king-bear", bot_descs, bIsRestart)

	return true

end

function onLevelBossSpeech()

	say("king-bear", localize("CASTLE_BOSS_1"))
	say("lumberjack", localize("CASTLE_BOSS_2"))
	say("king-bear", localize("CASTLE_BOSS_3"))
	say("lumberjack", localize("CASTLE_BOSS_4"))
	say("king-bear", localize("CASTLE_BOSS_5"), nil, onLevelBossSpeechEnd)

end
