local function zoom_camera(x_loc,y_loc,zoom,time)
	
	local tile_size = 8
	
	local location = vector2(x_loc*tile_size+160, y_loc*tile_size+80)
	
	coroutine.yield(engine.Scene:ZoomTo(location, zoom, time))
	
end

local function zoom_back(time)
	coroutine.yield(engine.Scene:ZoomBack(time))
end

local x_loc = player.Position.x
local y_loc = player.Position.y
player.ForceCameraUpdate = true

function onBegin(room)

	disableMovement ()
	zoom_camera(5,0,1.4,0.5)
	walk(8)
	
	if getFlag("Ch2_moon") == false then
		
		say("StuffoWOC_Missed_Otal")
	
	elseif getFlag("collected_moon") == false and getFlag("recived_quest") == false then
		
		say("StuffoWOC03_otal_a")
		setFlag("recived_quest", true)
		
	elseif getFlag("collected_moon") == true and getFlag("talked_to") == true then
		
		say("StuffoWOC03_otal_e")
		
	elseif getFlag("collected_moon") == true and getFlag("recived_quest") == false then
		
		say("StuffoWOC03_otal_b")
		setFlag("talked_to", true)
		
	elseif getFlag("collected_moon") == true and getFlag("recived_quest") == true then
		
		say("StuffoWOC03_otal_c")
		setFlag("talked_to", true)
		
	elseif getFlag("collected_moon") == false and getFlag("recived_quest") == true then
		
		say("StuffoWOC03_otal_d")
	
	end
	
	zoom_back(0.5)
	enableMovement()
	
end

function onEnd(room, wasSkipped)
	
	
	if getFlag("Ch2_moon") == false then
		
		say("StuffoWOC_Missed_Otal")
	
	elseif getFlag("collected_moon") == false and getFlag("recived_quest") == false then
		
		setFlag("recived_quest", true)
		
	elseif getFlag("collected_moon") == true and getFlag("recived_quest") == false then
		
		setFlag("talked_to", true)
		
	elseif getFlag("collected_moon") == true and getFlag("recived_quest") == true then
		
		setFlag("talked_to", true)
		
	end
	enableMovement()
	
end