function OnSceneLoad(screen)
    game_state = {}    
    LoadData(screen)
    local pf = play_field
    local level = pf:GetLevelScreen()
    game_state.custom_cursors = {}
    game_state.locked_objects = {}
    --level:AddTaskSafe(CreateTask('', '', ''))
    --zone = CreateZoomZone('')
    game_state.locker = ReferenceCounter()
    game_state.active_zone = nil
    game_state.inventory_zones = {}
	game_state.active_objects = {}
	
	-------------------------------------------------------------------------------------------
    -- init comics
    InitChain1(screen);
	game_state.chain1.state_changer = 'OnStartingComicsComplete'
    InitChain2(screen);
	game_state.chain2.final = true
	
	level:AddTaskSafe(CreateTask('OCTOPUS', '', 'picture'));
	
    AddSheriffEyeLogic();
	
	game_state.OnStartingComicsComplete = function()
	end
end

function InitChain1(screen)
    local comics1 = CreateComics(screen, 'Sheriff', 'eyes');
    local comics2 = CreateComics(screen, 'Security_Guard');
    local comics3 = CreateComics(screen, 'Sheriff', 'eyes');
	local comics4 = CreateComics(screen, 'Sheriff', 'eyes');
    
    game_state.chain1 = CreateChain('pixel_comics_1',
                                    screen,
                                    comics1, GetString("COMICS_34_4"),
                                    comics2, GetString("COMICS_34_5"),
                                    comics3, GetString("COMICS_34_6"));
end

function InitChain2(screen)
    local comics1 = CreateComics(screen, 'Sheriff', 'eyes');
	
	comics1.OnHidden = function()
		OnWin()
	end
   
    game_state.chain2 = CreateChain('pixel_comics_2',
                                    screen,
                                    comics1, GetString("COMICS_34_7") );
end

function OnSceneFree(screen)
    FreeData(screen)
end

function OnNotebookClosed()
	game_state.chain2.Start()
end

function OnUpdate(dt)
end

function OnScreenShown()
    game_state.chain1.Start();
end

function OnExit()
end

function OnMinigameCompleted()
end

function OnObjectMouseEnter(object)
    DefaultOnObjectMouseEnter(object)
end

function OnObjectMouseLeave(object)
    DefaultOnObjectMouseLeave(object)
end

function OnObjectMouseDown(object)
    obj_name = object:GetName()
    local pf = play_field
    local is_wrong_click = true

    is_wrong_click = DefaultOnObjectMouseDown(object)

    if is_wrong_click then
        --pf:ShowWrongObjectEffect()
    end

    return is_wrong_click;    
end

function OnObjectMouseUp(object)
end

function OnObjectWillBeFound(object)
	if object:GetName() == 'picture' then
		play_field:GetObject('shadow'):ChangeOpacity(1, 0, 0.3)
	end
end

function OnObjectWasFound(object)	
end

function OnToolFound(tool)
end

function OnToolApply(tool, object)
    DefaultOnToolApply(tool, object)
end

function OnObjectReachPanel(object)
end

function OnButtonPress(title)
    DefaultOnButtonPress(title)
end

function OnMouseMove(previous_pos, current_pos)
end

function OnSetTool(tool)
end


function OnLostFocus()
end

function OnGainFocus()
end

function CanBeHinted(obj)
    if locked_object[obj] ~= true then
        return true
    else
        return false
    end
end

-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function LoadData(screen)
	local anim = CreateAnimation('data/Texture/Comics/eyes.png',0,0,79,33,1,0)
	anim:SetHotSpot(39,16)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('eyes',anim,725,208,500,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('pixel_comics_1',anim,512,384,401,0,128,96)
	local anim = CreateAnimation('data/Texture/Scenes/Common/pixel.jpg',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('pixel_comics_2',anim,512,384,401,0,128,96)
	local anim = CreateAnimation('data/Texture/Comics/Sheriff.dds',0,0,532,636,1,0)
	anim:SetHotSpot(266,256)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('Sheriff',anim,734,390,200,0,1,1)
	local anim = CreateAnimation('data/Texture/Comics/Security_Guard.dds',0,0,632,696,1,0)
	anim:SetHotSpot(316,348)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('Security_Guard',anim,684,423,400,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/34.5_prison_break/bg.jpg',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('bg',anim,512,384,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/34.5_prison_break/picture.png',0,0,140,157,1,0)
	anim:SetHotSpot(70,78)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('picture',anim,561,486,112,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/34.5_prison_break/shadow.png',0,0,271,261,1,0)
	anim:SetHotSpot(135,130)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('shadow',anim,601,497,100,0,1,1)
end

function FreeData(screen)
end
-- CLEAR_ON_SAVE_END
