dofile('data/Scripts/Scenes/Common.lua');
dofile('data/Scripts/Scenes/Animations/22_NearBalloon_Animations.lua');

------------------------------------------------------------------------------
--
function OnSceneLoad(restoringFromSave)
	InitGameState();

	play_field = playField;
    LoadData();
	play_field = nil;

    RootZoomZone = CreateZoomZone('RootZoomZone', nil, 
                                   nil, 0.0, 
                                   nil, 0.0,
							{'RootBackground',

							 'axe',
							 'bamboo',
							 'bottle1',
							 'bottle2',
							 'bouquet',
							 'bow',
							 'bucket',
							 'butterfly',
							 'chisel',
							 'cockroach',
							 'dino',
							 'dragonfly',
							 'fretsaw',
							 'grasshopper',
							 'hammer',
							 'handDrill1',
							 'handDrill2',
							 'hook',
							 'lantern1',
							 'lantern2',
							 'lighter',
							 'lizard',
							 'pliers',
							 'rope1',
							 'rope2',
							 'sack',
							 'scarf',
							 'scorpion',
							 'sheep',
							 'snake',
							 'spring',
							 'timber',
							 'tip',
							 'typewriter',
							 'vase1',
							 'vase2',
							 'vise1',
							 'vise2',
							 'vise3',
							 'wrench1',
							 'wrench2',

							 'ladder',
							 'fabricHole',
							 'fabricHoleWithGlue',

							 'LayerOverAxe',
							 'LayerOverBamboo',
							 'LayerOverBottle1',
							 'LayerOverBottle2',
							 'LayerOverBow',
							 'LayerOverBucket',
							 'LayerOverFretsaw',
							 'LayerOverGlue',
							 'LayerOverHandDrill1',
							 'LayerOverHandDrill2',
							 'LayerOverHook',
							 'LayerOverLantern1',
							 'LayerOverLantern2',
							 'LayerOverPliers',
							 'LayerOverRope1',
							 'LayerOverSack',
							 'LayerOverScarf',
							 'LayerOverScorpion',
							 'LayerOverSpring',
							 'LayerOverTimber',
							 'LayerOverTip',
							 'LayerOverTypewriter',
							 'LayerOverVise2',
							 'LayerOverWrench1',
							 'LayerOverWrench2',

							 'Ballast1_onPlace',
							 'Ballast2_onPlace',
							 'Ballast3_onPlace',
							 'Ballast4_onPlace',
							 'Ballast',
							 'Can',
							 'Glue',
							 'HeaterPart',
							 'HeaterPart_onPlace',
							 'Lever',
							 'Lever_onPlace',
							 'Patch',
							 'Patch_onPlace',

							 'actZoneBallast1',
							 'actZoneBallast2',
							 'actZoneBallast3',
							 'actZoneBallast4',
							 'actZoneHole',
							 'actZoneLever',
							 'actZoneHeaterPart',
							 'actZoneCan'},

		 					{});

if (restoringFromSave == false) then
    AddRandomTasks(true, MISC_TASK_COUNT_24,
		CreateTask('axe'),
		CreateTask('bamboo'),
--		CreateTask('bottle1'),
		CreateTask('bottle2'),
		CreateTask('bouquet'),
		CreateTask('bow'),
		CreateTask('bucket'),
		CreateTask('butterfly'),
		CreateTask('chisel'),
		CreateTask('cockroach'),
		CreateTask('dino'),
		CreateTask('dragonfly'),
		CreateTask('fretsaw'),
		CreateTask('grasshopper'),
		CreateTask('hammer'),
		CreateTask('handDrill1'),
		CreateTask('handDrill2'),
		CreateTask('hook'),
		CreateTask('lantern1'),
		CreateTask('lantern2'),
		CreateTask('lighter'),
		CreateTask('lizard'),
		CreateTask('pliers'),
		CreateTask('rope1'),
		CreateTask('rope2'),
		CreateTask('sack'),
		CreateTask('scarf'),
		CreateTask('scorpion'),
		CreateTask('sheep'),
		CreateTask('snake'),
		CreateTask('spring'),
		CreateTask('timber'),
		CreateTask('tip'),
		CreateTask('typewriter'),
		CreateTask('vase1'),
		CreateTask('vase2'),
		CreateTask('vise1'),
		CreateTask('vise2'),
		CreateTask('vise3'),
		CreateTask('wrench1'),
		CreateTask('wrench2')
	);

    playField:GetLevelScreen():AddTaskSafe(CreateTask('Ballast'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Can'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Glue'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('HeaterPart'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Lever'));
    playField:GetLevelScreen():AddTaskSafe(CreateTask('Patch'));
end

	CreateToolMap(	{'Ballast',		'actZoneBallast1'},
					{'Can',			'actZoneCan'},
					{'Glue',		'actZoneHole'},
					{'HeaterPart',  'actZoneHeaterPart'},
					{'Lever', 		'actZoneLever'},
					{'Patch',		'actZoneHole'});

	SetIconForGameObject(playField:GetObject('axe'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/axe_icon.png');
	SetIconForGameObject(playField:GetObject('bamboo'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/bamboo_icon.png');
	SetIconForGameObject(playField:GetObject('bottle1'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/bottle1_icon.png');
	SetIconForGameObject(playField:GetObject('bottle2'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/bottle2_icon.png');
	SetIconForGameObject(playField:GetObject('bouquet'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/bouquet_icon.png');
	SetIconForGameObject(playField:GetObject('bow'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/bow_icon.png');
	SetIconForGameObject(playField:GetObject('bucket'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/bucket_icon.png');
	SetIconForGameObject(playField:GetObject('butterfly'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/butterfly_icon.png');
	SetIconForGameObject(playField:GetObject('chisel'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/chisel_icon.png');
	SetIconForGameObject(playField:GetObject('cockroach'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/cockroach_icon.png');
	SetIconForGameObject(playField:GetObject('dino'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/dino_icon.png');
	SetIconForGameObject(playField:GetObject('dragonfly'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/dragonfly_icon.png');
	SetIconForGameObject(playField:GetObject('fretsaw'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/fretsaw_icon.png');
	SetIconForGameObject(playField:GetObject('grasshopper'),'data/Texture/Scenes/22_NearBalloon/Items/Misc/grasshopper_icon.png');
	SetIconForGameObject(playField:GetObject('hammer'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/hammer_icon.png');
	SetIconForGameObject(playField:GetObject('handDrill1'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/handDrill1_icon.png');
	SetIconForGameObject(playField:GetObject('handDrill2'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/handDrill2_icon.png');
	SetIconForGameObject(playField:GetObject('hook'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/hook_icon.png');
	SetIconForGameObject(playField:GetObject('lantern1'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/lantern1_icon.png');
	SetIconForGameObject(playField:GetObject('lantern2'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/lantern2_icon.png');
	SetIconForGameObject(playField:GetObject('lighter'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/lighter_icon.png');
	SetIconForGameObject(playField:GetObject('lizard'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/lizard_icon.png');
	SetIconForGameObject(playField:GetObject('pliers'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/pliers_icon.png');
	SetIconForGameObject(playField:GetObject('rope1'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/rope1_icon.png');
	SetIconForGameObject(playField:GetObject('rope2'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/rope2_icon.png');
	SetIconForGameObject(playField:GetObject('sack'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/sack_icon.png');
	SetIconForGameObject(playField:GetObject('scarf'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/scarf_icon.png');
	SetIconForGameObject(playField:GetObject('scorpion'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/scorpion_icon.png');
	SetIconForGameObject(playField:GetObject('sheep'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/sheep_icon.png');
	SetIconForGameObject(playField:GetObject('snake'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/snake_icon.png');
	SetIconForGameObject(playField:GetObject('spring'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/spring_icon.png');
	SetIconForGameObject(playField:GetObject('timber'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/timber_icon.png');
	SetIconForGameObject(playField:GetObject('tip'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/tip_icon.png');
	SetIconForGameObject(playField:GetObject('typewriter'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/typewriter_icon.png');
	SetIconForGameObject(playField:GetObject('vase1'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/vase1_icon.png');
	SetIconForGameObject(playField:GetObject('vase2'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/vase2_icon.png');
	SetIconForGameObject(playField:GetObject('vise1'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/vise1_icon.png');
	SetIconForGameObject(playField:GetObject('vise2'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/vise2_icon.png');
	SetIconForGameObject(playField:GetObject('vise3'),		'data/Texture/Scenes/22_NearBalloon/Items/Misc/vise3_icon.png');
	SetIconForGameObject(playField:GetObject('wrench1'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/wrench1_icon.png');
	SetIconForGameObject(playField:GetObject('wrench2'),	'data/Texture/Scenes/22_NearBalloon/Items/Misc/wrench2_icon.png');

	SetIconForGameObject(playField:GetObject('Ballast'),	'data/Texture/Scenes/22_NearBalloon/Items/Ballast_icon.png');
	SetIconForGameObject(playField:GetObject('Can'),	    'data/Texture/Scenes/22_NearBalloon/Items/Can_icon.png');
	SetIconForGameObject(playField:GetObject('Glue'),	    'data/Texture/Scenes/22_NearBalloon/Items/Glue_icon.png');
	SetIconForGameObject(playField:GetObject('HeaterPart'), 'data/Texture/Scenes/22_NearBalloon/Items/HeaterPart_icon.png');
	SetIconForGameObject(playField:GetObject('Lever'),	    'data/Texture/Scenes/22_NearBalloon/Items/Lever_icon.png');
	SetIconForGameObject(playField:GetObject('Patch'),	    'data/Texture/Scenes/22_NearBalloon/Items/Patch_icon.png');

if (restoringFromSave == false) then
	gameState.ballastOnPlace = false;
	gameState.canUsed = false;
	gameState.glueUsed = false;
	gameState.heaterPartOnPlace = false;
	gameState.leverOnPlace = false;
	gameState.patchUsed = false;

	gameState.allToolsApplied = false;
	gameState.levelCompleted = false;
end

	AssignActiveZonesGlow({function() return gameState.ballastOnPlace; end,		'actZoneBallast1',	'Ballast1_ghost'},
						  {function() return gameState.ballastOnPlace; end,		'actZoneBallast2',	'Ballast2_ghost'},
						  {function() return gameState.ballastOnPlace; end,		'actZoneBallast3',	'Ballast3_ghost'},
						  {function() return gameState.ballastOnPlace; end,		'actZoneBallast4',	'Ballast4_ghost'},
						  {function() return gameState.canUsed; end,			'actZoneCan',		'Can_ghost'},
					      {function() return gameState.glueUsed; end,			'actZoneHole',		'Glue_ghost'},
						  {function() return gameState.heaterPartOnPlace; end,	'actZoneHeaterPart','HeaterPart_ghost'},
						  {function() return gameState.leverOnPlace; end,		'actZoneLever',		'Lever_ghost'},
						  {function() return gameState.patchUsed or
											not gameState.glueUsed; end,		'actZoneHole',		'Patch_ghost'});

    ApplyLevelDump(restoringFromSave);
	SetZoneVisible(RootZoomZone, true, false);

	auxSceneInit(restoringFromSave);
	auxProcessToolObjectStateAnCursorType();
end

------------------------------------------------------------------------------
--
function OnSceneFree()
    FreeData()

	StopSound('L22S10');
end

--// Local auxiliary functions - - - - - - - - - - - - - - - - - - - - - - - -
function auxSceneInit(restoringFromSave)
    local initialActions = function()
		ShowLevelIntro(22);
    end
	local regularActions = function()
--		gameState.customCursors[''] = {'CursorZoom'};

		playField:IgnoreOnTestPoint('ladder');

		playField:IgnoreOnTestPoint('LayerOverAxe');
		playField:IgnoreOnTestPoint('LayerOverBamboo');
		playField:IgnoreOnTestPoint('LayerOverBottle1');
		playField:IgnoreOnTestPoint('LayerOverBottle2');
		playField:IgnoreOnTestPoint('LayerOverBow');
		playField:IgnoreOnTestPoint('LayerOverBucket');
		playField:IgnoreOnTestPoint('LayerOverFretsaw');
		playField:IgnoreOnTestPoint('LayerOverGlue');
		playField:IgnoreOnTestPoint('LayerOverHandDrill1');
		playField:IgnoreOnTestPoint('LayerOverHandDrill2');
		playField:IgnoreOnTestPoint('LayerOverHook');
		playField:IgnoreOnTestPoint('LayerOverLantern1');
		playField:IgnoreOnTestPoint('LayerOverLantern2');
		playField:IgnoreOnTestPoint('LayerOverPliers');
		playField:IgnoreOnTestPoint('LayerOverRope1');
		playField:IgnoreOnTestPoint('LayerOverSack');
		playField:IgnoreOnTestPoint('LayerOverScarf');
		playField:IgnoreOnTestPoint('LayerOverScorpion');
		playField:IgnoreOnTestPoint('LayerOverSpring');
		playField:IgnoreOnTestPoint('LayerOverTimber');
		playField:IgnoreOnTestPoint('LayerOverTip');
		playField:IgnoreOnTestPoint('LayerOverTypewriter');
		playField:IgnoreOnTestPoint('LayerOverVise2');
		playField:IgnoreOnTestPoint('LayerOverWrench1');
		playField:IgnoreOnTestPoint('LayerOverWrench2');

		auxCreateNearBalloonAnimations(playField:GetObject('RootBackground'));
		auxPlayNearBalloonAnimation('EnvTop');
--		auxPlayNearBalloonAnimation('Fly1');
--		auxPlayNearBalloonAnimation('Fly2'); 
--		auxPlayNearBalloonAnimation('Fly3');
--		auxPlayNearBalloonAnimation('Centipede');

		gameState.nextAnimationDelay = 0.0;
	end

    if (restoringFromSave == false) then
        initialActions();
	else
    end	
    regularActions();

	if (gameState.levelCompleted == true) then
		gameState.levelCompleted = false;
		auxTestLevelCompleteCondition();
	end
end


function auxProcessToolObjectStateAnCursorType()
    assert(	gameState.ballastOnPlace ~= nil and
			gameState.canUsed ~= nil and
			gameState.glueUsed ~= nil and
			gameState.heaterPartOnPlace ~= nil and
			gameState.leverOnPlace ~= nil and
			gameState.patchUsed ~= nil);

	if (gameState.ballastOnPlace == true) then
		RootZoomZone.UnhideObject('Ballast1_onPlace');
		RootZoomZone.UnhideObject('Ballast2_onPlace');
		RootZoomZone.UnhideObject('Ballast3_onPlace');
		RootZoomZone.UnhideObject('Ballast4_onPlace');
		gameState.customCursors['actZoneBallast1'] = nil;
		gameState.customCursors['actZoneBallast2'] = nil;
		gameState.customCursors['actZoneBallast3'] = nil;
		gameState.customCursors['actZoneBallast4'] = nil;
	else
		RootZoomZone.HideObject('Ballast1_onPlace');
		RootZoomZone.HideObject('Ballast2_onPlace');
		RootZoomZone.HideObject('Ballast3_onPlace');
		RootZoomZone.HideObject('Ballast4_onPlace');
		gameState.customCursors['actZoneBallast1'] = {'CursorArms'};
		gameState.customCursors['actZoneBallast2'] = {'CursorArms'};
		gameState.customCursors['actZoneBallast3'] = {'CursorArms'};
		gameState.customCursors['actZoneBallast4'] = {'CursorArms'};
	end

	if (gameState.canUsed == true) then
		gameState.customCursors['actZoneCan'] = nil;
	else
		gameState.customCursors['actZoneCan'] = {'CursorArms'};
	end

	if (gameState.glueUsed == true) then
		RootZoomZone.UnhideObject('fabricHoleWithGlue');
	else
		RootZoomZone.HideObject('fabricHoleWithGlue');
	end
	if (gameState.patchUsed == true) then
		RootZoomZone.UnhideObject('Patch_onPlace');
	else
		RootZoomZone.HideObject('Patch_onPlace');
	end
	if (gameState.glueUsed == true and gameState.patchUsed == true) then
		gameState.customCursors['actZoneHole'] = nil;
	else
		gameState.customCursors['actZoneHole'] = {'CursorArms'};
	end

	if (gameState.heaterPartOnPlace == true) then
		RootZoomZone.UnhideObject('HeaterPart_onPlace');
		gameState.customCursors['actZoneHeaterPart'] = nil;
	else
		RootZoomZone.HideObject('HeaterPart_onPlace');
		gameState.customCursors['actZoneHeaterPart'] = {'CursorArms'};
	end

	if (gameState.leverOnPlace == true) then
		RootZoomZone.UnhideObject('Lever_onPlace');
		gameState.customCursors['actZoneLever'] = nil;
	else
		RootZoomZone.HideObject('Lever_onPlace');
		gameState.customCursors['actZoneLever'] = {'CursorArms'};
	end
end

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxUpdatePeriodicAnimations(dt)
	if (gameState.nextAnimationDelay == 0.0) then
		local animations = {};

		for compositionName, composition in pairs(nearBalloonCompositions) do
			if (composition:IsCyclic() == false) then
				table.insert(animations, composition:GetName());
			end
		end

		local animName = animations[math.random(1, table.getn(animations))];
		if (animName ~= nil) then
			local composition = auxGetNearBalloonAnimation(animName);

            if (composition ~= nil and composition:IsPaused() == true) then
				auxPlayNearBalloonAnimation(animName);
			end
		end
		gameState.nextAnimationDelay = math.random(5, 14);
	else
		gameState.nextAnimationDelay = (gameState.nextAnimationDelay - dt >= 0.0 and gameState.nextAnimationDelay - dt or 0.0);
	end
end

--// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function auxTestLevelCompleteCondition()
	if (
		gameState.allToolsApplied == true and
		gameState.levelCompleted == false and
		playField:GetLevelScreen():HasUncompletedTask() == false) then

		gameState.levelCompleted = true;
		TimerDoString('OnWin();', 2.0, playField:GetTimer());
	end
end
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

------------------------------------------------------------------------------
--
function OnDialogButtonPress(name, param)
end

------------------------------------------------------------------------------
--
function OnUpdate(dt)
    DefaultOnUpdate(dt);
	auxUpdatePeriodicAnimations(dt);
end

------------------------------------------------------------------------------
--
function OnWin()
	DefaultOnWin();
end

------------------------------------------------------------------------------
--
function OnObjectMouseEnter(object)
    local objectName = object:GetName();

    DefaultOnObjectMouseEnter(object);
	ActivateActiveZoneGlow(objectName);
end

------------------------------------------------------------------------------
--
function OnObjectMouseLeave(object)
    local objectName = object:GetName();

    DefaultOnObjectMouseLeave(object);
    DeactivateActiveZoneGlow(objectName);
end

------------------------------------------------------------------------------
--
function OnObjectMouseDown(object)
    local objectName = object:GetName();
    local isWrongClick = true;

	assert(gameState.activeZone ~= nil and gameState.locker:GetNReferences() > 0);

    if (gameState.lockedObjects[objectName] ~= true) then
        if (gameState.activeZone.HasObject(objectName)) then
            isWrongClick = DefaultOnZoomZoneActiveObjectClick(objectName);

			--// ...

	        if (isWrongClick == true and playField:GetLevelScreen():IsTaskObject(objectName)) then
	            auxAttachInPlace(object, playField);
				object:ResetClippingRect();
				--// remove object from zoom-zone which contents it
				assert(gameState.activeZone.objects[objectName] ~= nil);
				gameState.activeZone.objects[objectName] = nil;

                playField:OnObjectFound(object);
                isWrongClick = false;
            end
        else
--			assert(gameState.activeZone ~= RootZoomZone and 
--				   gameState.locker:GetNReferences() > 1 and
--				   'Attempt to close root scene - you have clicked on an object which hasn`t been added to any zoom-zone');
            if (gameState.activeZone ~= RootZoomZone and gameState.locker:GetNReferences() > 1) then
                if (gameState.lockedObjects[gameState.activeZone.activeObject] == nil) then
                    SetZoneVisible(gameState.activeZone, false);
                end
            else
                Log('Lua: OnObjectMouseDown(\''..objectName..'\'): Was made click on object which hasn`t been attached to any zoom-zone');
            end
        end --// if (gameState.activeZone.HasObject(...
    end --// if (gameState.lockedObjects[...

	--// Tips - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	if (objectName == 'actZoneHole' and gameState.glueUsed == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL22_HOLE_GLUE_TIP1'));
	elseif (objectName == 'actZoneHole' and gameState.patchUsed == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL22_HOLE_PATCH_TIP1'));
	elseif (objectName == 'actZoneCan' and gameState.canUsed == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL22_WATERCAN_TIP1'));
	elseif (objectName == 'actZoneHeaterPart' and gameState.heaterPartOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL22_MECHPART_TIP1'));
	elseif ((objectName == 'actZoneBallast1' or
			 objectName == 'actZoneBallast2' or
			 objectName == 'actZoneBallast3' or
			 objectName == 'actZoneBallast4') and gameState.ballastOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL22_BALLAST_TIP1'));
	elseif (objectName == 'actZoneLever' and gameState.leverOnPlace == false) then
	    playField:GetLevelScreen():ShowTip(GetTextString('LEVEL22_LEVER_TIP1'));
	else
	    playField:GetLevelScreen():HideTip();
	end
	--//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    DefaultOnObjectClick(object, isWrongClick, not playField:GetLevelScreen():IsTipShown());
    DefaultOnObjectMouseEnter(object);
end

------------------------------------------------------------------------------
--
function OnObjectMouseUp(object)
end

------------------------------------------------------------------------------
--
function OnObjectFound(object)
    local objectName = object:GetName();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	local objectMustBeHighlighted = DefaultOnObjectFound(object);
	return objectMustBeHighlighted;
end

------------------------------------------------------------------------------
--
function OnToolFound(tool)
end

------------------------------------------------------------------------------
--
function CanToolBeApplied(tool, object)
	local toolName = tool:GetName();
	local objName = object:GetName();
    local canToolBeApplied = true;
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	canToolBeApplied = DefaultCanToolBeApplied(tool, object);
	return canToolBeApplied;
end

------------------------------------------------------------------------------
--
function OnToolApply(tool, object)
	local toolName = tool:GetName();
	local objName = object:GetName();
    local toolApplied = false;

	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	if (toolName == 'Ballast' and (objName == gameState.toolMap[toolName] or
								   objName == 'actZoneBallast1' or
								   objName == 'actZoneBallast2' or
								   objName == 'actZoneBallast3' or
								   objName == 'actZoneBallast4')) then
		gameState.ballastOnPlace = true;
		toolApplied = true;
	end
	if (toolName == 'Can' and objName == gameState.toolMap[toolName]) then
		gameState.canUsed = true;
		toolApplied = true;
		PlaySound('L22S10');
	end
	if (toolName == 'Glue' and objName == gameState.toolMap[toolName]) then
		gameState.glueUsed = true;
		toolApplied = true;
	end
	if (toolName == 'HeaterPart' and objName == gameState.toolMap[toolName]) then
		gameState.heaterPartOnPlace = true;
		toolApplied = true;
	end
	if (toolName == 'Lever' and objName == gameState.toolMap[toolName]) then
		gameState.leverOnPlace = true;
		toolApplied = true;
	end
	if (toolName == 'Patch' and objName == gameState.toolMap[toolName]) then
		if (gameState.glueUsed == true) then
			gameState.patchUsed = true;
			toolApplied = true;
		else
		    playField:GetLevelScreen():ShowTip(GetTextString('CANNT_USE_ITEM_YET_TIP1'), 
											   GetTextString('CANNT_USE_ITEM_YET_TIP2'));
			return;
		end
	end
	if (not toolApplied) then
	    playField:GetLevelScreen():ShowTip(GetTextString('WRONG_ITEM_APPLIED_TIP1'),
										   GetTextString('WRONG_ITEM_APPLIED_TIP2'));
	end

	if (gameState.ballastOnPlace == true and
		gameState.canUsed == true and
		gameState.glueUsed == true and
		gameState.heaterPartOnPlace == true and
		gameState.leverOnPlace == true and
		gameState.patchUsed == true and
		gameState.allToolsApplied == false) then

		gameState.allToolsApplied = true;
		if (playField:GetLevelScreen():HasUncompletedTask() == true) then
		    playField:GetLevelScreen():ShowTip(GetTextString('HAVE_TO_FIND_ITEMS_MSG1'),
											   GetTextString('HAVE_TO_FIND_ITEMS_MSG2'));
		else
			auxTestLevelCompleteCondition();
		end
	end

	auxProcessToolObjectStateAnCursorType();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    DefaultOnObjectMouseEnter(object);
	if (toolApplied == true) then
	    DeactivateActiveZoneDeactivatedGlow(object:GetName());
	end
	return toolApplied;
end

------------------------------------------------------------------------------
--
function OnObjectReachPanel(object)
    local objectName = object:GetName();
	-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	auxTestLevelCompleteCondition();
end

------------------------------------------------------------------------------
--
function OnButtonPress(zoneName)
    DefaultOnButtonPress(zoneName);
end

------------------------------------------------------------------------------
--
function OnMouseMove(prevMousePos, currentMousePos)
end

------------------------------------------------------------------------------
--
function OnSetTool(tool)
end

------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function LoadData()
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/background.jpg',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('RootBackground',anim,512,384,98,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/axe.png',0,0,91,111,1,0)
	anim:SetHotSpot(45,55)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('axe',anim,319,356,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/bamboo.png',0,0,34,111,1,0)
	anim:SetHotSpot(17,55)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bamboo',anim,892,705,107,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/bottle1.png',0,0,49,88,1,0)
	anim:SetHotSpot(24,44)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bottle1',anim,879,566,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/bottle2.png',0,0,46,100,1,0)
	anim:SetHotSpot(23,50)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bottle2',anim,347,600,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/bouquet.png',0,0,92,45,1,0)
	anim:SetHotSpot(46,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bouquet',anim,960,312,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/bow.png',0,0,58,161,1,0)
	anim:SetHotSpot(29,80)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bow',anim,851,228,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/bucket.png',0,0,68,114,1,0)
	anim:SetHotSpot(34,57)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('bucket',anim,427,436,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/butterfly.png',0,0,77,69,1,0)
	anim:SetHotSpot(38,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('butterfly',anim,175,511,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/chisel.png',0,0,88,45,1,0)
	anim:SetHotSpot(44,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('chisel',anim,813,708,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/cockroach.png',0,0,52,35,1,0)
	anim:SetHotSpot(26,17)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('cockroach',anim,628,505,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/dino.png',0,0,52,47,1,0)
	anim:SetHotSpot(26,23)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('dino',anim,228,35,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/dragonfly.png',0,0,103,56,1,0)
	anim:SetHotSpot(51,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('dragonfly',anim,427,179,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/fretsaw.png',0,0,107,107,1,0)
	anim:SetHotSpot(53,53)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('fretsaw',anim,859,591,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/grasshopper.png',0,0,123,41,1,0)
	anim:SetHotSpot(61,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('grasshopper',anim,650,742,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/hammer.png',0,0,141,73,1,0)
	anim:SetHotSpot(70,36)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('hammer',anim,400,716,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/handDrill1.png',0,0,88,98,1,0)
	anim:SetHotSpot(44,49)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('handDrill1',anim,177,85,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/handDrill2.png',0,0,71,139,1,0)
	anim:SetHotSpot(35,69)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('handDrill2',anim,233,682,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/hook.png',0,0,105,46,1,0)
	anim:SetHotSpot(52,23)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('hook',anim,709,707,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/lantern1.png',0,0,43,95,1,0)
	anim:SetHotSpot(21,47)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('lantern1',anim,217,210,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/lantern2.png',0,0,63,84,1,0)
	anim:SetHotSpot(31,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('lantern2',anim,983,586,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/lighter.png',0,0,52,54,1,0)
	anim:SetHotSpot(26,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('lighter',anim,809,669,106,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/lizard.png',0,0,139,100,1,0)
	anim:SetHotSpot(69,50)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('lizard',anim,682,89,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/pliers.png',0,0,98,44,1,0)
	anim:SetHotSpot(49,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('pliers',anim,669,611,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/rope1.png',0,0,83,87,1,0)
	anim:SetHotSpot(41,43)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('rope1',anim,276,322,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/rope2.png',0,0,67,59,1,0)
	anim:SetHotSpot(33,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('rope2',anim,767,684,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/sack.png',0,0,110,106,1,0)
	anim:SetHotSpot(55,53)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('sack',anim,304,684,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/scarf.png',0,0,93,97,1,0)
	anim:SetHotSpot(46,48)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('scarf',anim,960,441,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/scorpion.png',0,0,83,106,1,0)
	anim:SetHotSpot(41,53)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('scorpion',anim,196,299,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/sheep.png',0,0,62,56,1,0)
	anim:SetHotSpot(31,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('sheep',anim,352,124,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/snake.png',0,0,115,85,1,0)
	anim:SetHotSpot(57,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('snake',anim,369,49,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/spring.png',0,0,68,85,1,0)
	anim:SetHotSpot(34,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('spring',anim,928,679,106,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/timber.png',0,0,141,102,1,0)
	anim:SetHotSpot(70,51)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('timber',anim,859,633,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/tip.png',0,0,66,101,1,0)
	anim:SetHotSpot(33,50)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('tip',anim,499,442,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/typewriter.png',0,0,126,85,1,0)
	anim:SetHotSpot(63,42)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('typewriter',anim,515,645,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/vase1.png',0,0,64,72,1,0)
	anim:SetHotSpot(32,36)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('vase1',anim,390,647,106,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/vase2.png',0,0,78,67,1,0)
	anim:SetHotSpot(39,33)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('vase2',anim,772,638,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/vise1.png',0,0,135,61,1,0)
	anim:SetHotSpot(67,30)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('vise1',anim,368,737,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/vise2.png',0,0,93,97,1,0)
	anim:SetHotSpot(46,48)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('vise2',anim,852,404,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/vise3.png',0,0,130,63,1,0)
	anim:SetHotSpot(65,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('vise3',anim,851,57,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/wrench1.png',0,0,43,97,1,0)
	anim:SetHotSpot(21,48)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('wrench1',anim,428,611,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Misc/wrench2.png',0,0,57,111,1,0)
	anim:SetHotSpot(28,55)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('wrench2',anim,549,235,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/ladder.png',0,0,159,514,1,0)
	anim:SetHotSpot(79,257)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('ladder',anim,943,405,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/fabricHole.png',0,0,67,77,1,0)
	anim:SetHotSpot(33,38)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('fabricHole',anim,418,266,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/fabricHoleWithGlue.png',0,0,58,80,1,0)
	anim:SetHotSpot(29,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('fabricHoleWithGlue',anim,418,269,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverAxe.png',0,0,94,117,1,0)
	anim:SetHotSpot(47,58)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverAxe',anim,319,355,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverBamboo.png',0,0,30,39,1,0)
	anim:SetHotSpot(15,19)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBamboo',anim,905,740,109,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverBottle1.png',0,0,42,38,1,0)
	anim:SetHotSpot(21,19)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBottle1',anim,886,595,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverBottle2.png',0,0,58,81,1,0)
	anim:SetHotSpot(29,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBottle2',anim,347,618,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverBow.png',0,0,40,108,1,0)
	anim:SetHotSpot(20,54)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBow',anim,859,202,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverBucket.png',0,0,55,111,1,0)
	anim:SetHotSpot(27,55)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverBucket',anim,437,438,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverFretsaw.png',0,0,61,48,1,0)
	anim:SetHotSpot(30,24)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverFretsaw',anim,865,613,106,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverGlue.png',0,0,107,54,1,0)
	anim:SetHotSpot(53,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverGlue',anim,964,741,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverHandDrill1.png',0,0,24,19,1,0)
	anim:SetHotSpot(12,9)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverHandDrill1',anim,139,130,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverHandDrill2.png',0,0,29,27,1,0)
	anim:SetHotSpot(14,13)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverHandDrill2',anim,225,750,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverHook.png',0,0,68,56,1,0)
	anim:SetHotSpot(34,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverHook',anim,684,706,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverLantern1.png',0,0,38,26,1,0)
	anim:SetHotSpot(19,13)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverLantern1',anim,221,173,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverLantern2.png',0,0,66,35,1,0)
	anim:SetHotSpot(33,17)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverLantern2',anim,985,617,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverPliers.png',0,0,101,37,1,0)
	anim:SetHotSpot(50,18)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverPliers',anim,669,620,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverRope1.png',0,0,30,45,1,0)
	anim:SetHotSpot(15,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverRope1',anim,285,294,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverSack.png',0,0,48,80,1,0)
	anim:SetHotSpot(24,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverSack',anim,262,674,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverScarf.png',0,0,63,57,1,0)
	anim:SetHotSpot(31,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverScarf',anim,957,397,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverScorpion.png',0,0,79,116,1,0)
	anim:SetHotSpot(39,58)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverScorpion',anim,201,295,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverSpring.png',0,0,79,45,1,0)
	anim:SetHotSpot(39,22)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverSpring',anim,934,705,107,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverTimber.png',0,0,125,68,1,0)
	anim:SetHotSpot(62,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverTimber',anim,877,656,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverTip.png',0,0,23,16,1,0)
	anim:SetHotSpot(11,8)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverTip',anim,527,398,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverTypewriter.png',0,0,131,108,1,0)
	anim:SetHotSpot(65,54)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverTypewriter',anim,521,647,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverVise2.png',0,0,28,37,1,0)
	anim:SetHotSpot(14,18)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverVise2',anim,855,370,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverWrench1.png',0,0,46,105,1,0)
	anim:SetHotSpot(23,52)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverWrench1',anim,431,610,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Layers/LayerOverWrench2.png',0,0,49,51,1,0)
	anim:SetHotSpot(24,25)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('LayerOverWrench2',anim,548,232,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Ballast1_onPlace.png',0,0,59,90,1,0)
	anim:SetHotSpot(29,45)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Ballast1_onPlace',anim,475,556,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Ballast1_ghost.png',0,0,80,110,1,0)
	anim:SetHotSpot(40,55)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Ballast1_ghost',anim,475,557,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Ballast2_onPlace.png',0,0,76,98,1,0)
	anim:SetHotSpot(38,49)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Ballast2_onPlace',anim,580,561,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Ballast2_ghost.png',0,0,90,110,1,0)
	anim:SetHotSpot(45,55)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Ballast2_ghost',anim,580,563,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Ballast3_onPlace.png',0,0,74,104,1,0)
	anim:SetHotSpot(37,52)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Ballast3_onPlace',anim,740,558,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Ballast3_ghost.png',0,0,80,120,1,0)
	anim:SetHotSpot(40,60)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Ballast3_ghost',anim,742,558,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Ballast4_onPlace.png',0,0,63,98,1,0)
	anim:SetHotSpot(31,49)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Ballast4_onPlace',anim,844,551,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Ballast4_ghost.png',0,0,80,110,1,0)
	anim:SetHotSpot(40,55)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Ballast4_ghost',anim,844,551,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Ballast.png',0,0,132,86,1,0)
	anim:SetHotSpot(66,43)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Ballast',anim,958,97,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Can.png',0,0,80,128,1,0)
	anim:SetHotSpot(40,64)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Can',anim,531,488,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Can_ghost.png',0,0,96,96,1,0)
	anim:SetHotSpot(48,48)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Can_ghost',anim,799,264,110,-35,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Glue.png',0,0,91,52,1,0)
	anim:SetHotSpot(45,26)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Glue',anim,966,742,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Glue_ghost.png',0,0,100,100,1,0)
	anim:SetHotSpot(50,50)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Glue_ghost',anim,445,251,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/HeaterPart.png',0,0,80,80,1,0)
	anim:SetHotSpot(40,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('HeaterPart',anim,788,589,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/HeaterPart_ghost.png',0,0,90,90,1,0)
	anim:SetHotSpot(45,45)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('HeaterPart_ghost',anim,796,348,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/HeaterPart_onPlace.png',0,0,80,80,1,0)
	anim:SetHotSpot(40,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('HeaterPart_onPlace',anim,796,349,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Lever.png',0,0,80,41,1,0)
	anim:SetHotSpot(40,20)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Lever',anim,949,520,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Lever_ghost.png',0,0,120,80,1,0)
	anim:SetHotSpot(60,40)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Lever_ghost',anim,649,344,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Lever_onPlace.png',0,0,80,80,1,0)
	anim:SetHotSpot(40,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Lever_onPlace',anim,648,345,102,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Patch.png',0,0,80,49,1,0)
	anim:SetHotSpot(40,24)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Patch',anim,246,751,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Patch_ghost.png',0,0,90,90,1,0)
	anim:SetHotSpot(45,45)
	anim:SetBlendMode(0)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Patch_ghost',anim,387,258,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/22_NearBalloon/Items/Patch_onPlace.png',0,0,80,80,1,0)
	anim:SetHotSpot(40,40)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	play_field:CreateObject('Patch_onPlace',anim,412,274,104,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneBallast1',anim,477,554,106,0,0.6,0.8)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneBallast2',anim,583,556,106,0,0.6,0.8)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneBallast3',anim,741,553,106,0,0.6,0.8)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneBallast4',anim,832,545,103,0,0.6,0.8)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneHole',anim,422,262,105,0,1,0.9)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneLever',anim,647,342,104,0,0.8,0.8)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneHeaterPart',anim,797,358,102,-10,0.8,0.75)
	local anim = CreateAnimation('data/Texture/Scenes/Common/actZoneC.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	play_field:CreateObject('actZoneCan',anim,783,267,104,-40,0.85,0.7)
end

function FreeData()
end
-- CLEAR_ON_SAVE_END
