class 'l_06_Town_Z_Wall' (ZoomZone)

function l_06_Town_Z_Wall:__init(name, mode, PlayField)
	ZoomZone.__init(self, name, mode, PlayField)

	-- links ---------------------------------------------------------------
	self.playfield:linkScene('area_link_zw_mg',  'CursorGlass',   '06_Wall')	
	-----------------------------------------------------------------------

	-- find plane ---------------------------------------------------------
	do
		local function on_take_note(event)	  
			self:entityShow('area_apply_zw_chisel')     
	    end

		local function on_find_note(event)
	        self:entityHide('area_find_zw_note')
	    	self.playfield:entityHide('layer_poster')

	        self.playfield:addFlyNote('Note_06_Molinari_runaway', event.save, 'Layer_06_Fly_Molinari_runaway', true, nil, nil, Vector2f(0.5, 0.5), on_take_note)
	    	
	    	if not event.save then
	    		self:entityFadeHide('compositionposter_1X1','new_text_1','new_text_2')	
	    	else
	    		self:entityHide('compositionposter_1X1','new_text_1','new_text_2')
	    	end
	    end
	    self:registerActiveObject('area_find_zw_note', on_find_note, false)
	end
	-----------------------------------------------------------------------

	-- find plane ---------------------------------------------------------
	do
		if (not IsToolApplied('04_chisel')) then
			self.effectorBrick = CreateAnimationEffector()
			local brick = self:getEntityNamed('zw_brick')
			self.effectorBrick:attachTo( brick )
			local dt = 0.8

            self.effectorBrick:setKey(_TRACK_Y,   0 * dt, brick:getY())
            self.effectorBrick:setKey(_TRACK_Y, 0.2 * dt, brick:getY() + 3)
            self.effectorBrick:setKey(_TRACK_Y, 0.4 * dt, brick:getY() - 3)
            self.effectorBrick:setKey(_TRACK_Y, 0.6 * dt, brick:getY() + 2)
            self.effectorBrick:setKey(_TRACK_Y, 0.8 * dt, brick:getY() - 2)
            self.effectorBrick:setKey(_TRACK_Y, 1.2 * dt, brick:getY() + 1)
            self.effectorBrick:setKey(_TRACK_Y, 1.4 * dt, brick:getY() - 1)
		end

		local function on_apply_chisel(event)
			self:entityHide('area_apply_zw_chisel')
			self:entityShow('area_link_zw_mg', 'zw_chest', 'zw_hole')
			self.playfield:entityShow('Layer_hole')

			if not event.save then
				self:playSound('06_apply_zw_chisel')
				
				self:entityFadeShow('zw_chest', 'zw_hole')	

				self.mouseBlocker:push()
				self.timer:add( function() 
									self.mouseBlocker:pop()									
								end, 1.0)
			else
			end
		end

		local info = self:registerToolApplyInfo('04_chisel','area_apply_zw_chisel', on_apply_chisel, 'BBT_06_ZW_NEED_CHISEL')

		info.on_target_click = function()
			--self.effectorBrick:stop()
			self.playfield:stopSound('06_click_brick')
			self.playfield:playSound('06_click_brick')
			self.effectorBrick:play()
		end
	end
	-----------------------------------------------------------------------
end
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
function l_06_Town_Z_Wall:onClose()
	self.playfield:stopSound('06_click_brick')
end
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
--                      GENERATED CONTENT. DO NOT EDIT.                       --
--------------------------------------------------------------------------------

function l_06_Town_Z_Wall:CreateLoaderTable()
	local objects =
	{
		{ name = 'anchor_zw_sprites',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 2,  color = {r = 1, g = 1, b = 1, a = 0},  editingLocked = false,  treeItemIsExpanded = true,  width = 2,  height = 2,  },
		{ name = 'zw_hole',  entityType = 'SpriteEntity',  parentName = 'anchor_zw_sprites',  x = 69,  y = -31,  order = 2,  isVisible = false,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/06_Town/Z_Wall/zw_hole.png',  width = 290,  height = 184,  },
		{ name = 'zw_chest',  entityType = 'SpriteEntity',  parentName = 'anchor_zw_sprites',  x = 50,  y = -41,  order = 4,  isVisible = false,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/06_Town/Z_Wall/zw_chest.png',  width = 182,  height = 96,  },
		{ name = 'anchor_zw_areas',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 4,  color = {r = 1, g = 1, b = 1, a = 0},  editingLocked = false,  treeItemIsExpanded = true,  width = 2,  height = 2,  },
		{ name = 'area_find_zw_note',  entityType = 'SpriteEntity',  parentName = 'anchor_zw_areas',  x = 56,  y = 0,  order = 10,  scaleX = 4.5,  scaleY = 4.8,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = false,  width = 100,  height = 100,  },
		{ name = 'area_apply_zw_chisel',  entityType = 'SpriteEntity',  parentName = 'anchor_zw_areas',  x = 66,  y = -38,  order = 8,  isVisible = false,  isRespondable = false,  scaleX = 2.5,  scaleY = 2,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = false,  width = 100,  height = 100,  },
		{ name = 'area_link_zw_mg',  entityType = 'SpriteEntity',  parentName = 'anchor_zw_areas',  x = 66,  y = -38,  order = 6,  isVisible = false,  isRespondable = false,  scaleX = 2.5,  scaleY = 2,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = false,  width = 100,  height = 100,  },
		{ name = 'zw_Bg',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/06_Town/Z_Wall/zw_Bg.jpg',  width = 640,  height = 480,  },
		{ name = 'zw_brick',  entityType = 'SpriteEntity',  parentName = 'zw_Bg',  x = 72,  y = -42,  order = 10,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/06_Town/Z_Wall/zw_brick.png',  width = 236,  height = 106,  },
		{ name = '06_Town_Anim_Z_Wall',  entityType = 'CompositionContainer',  x = 192,  y = 145,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  path = 'Data/Scripts/Scenes/06_Town/Anim/06_Town_Anim_Z_Wall.lua',  },
		{ name = 'compositionposter_1X1',  entityType = 'CompositionSequence',  parentName = '06_Town_Anim_Z_Wall',  x = 0,  y = 0,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  isCyclic = true,  speed = 1,  },
		{ name = 'new_text_1',  entityType = 'TextEntity',  x = 528.002,  y = 168.001,  order = 5,  isRespondable = false,  angle = -3,  color = {r = 0.835294, g = 0.0784314, b = 0, a = 1},  editingLocked = false,  treeItemIsExpanded = false,  localizationKey = 'FLYNOTE_06_MOLINARI_RUNAWAY_1',  font = 'Data/Fonts/Options.fnt',  height = 42,  },
		{ name = 'new_text_2',  entityType = 'TextEntity',  x = 552.005,  y = 491.003,  order = 5,  isRespondable = false,  angle = -8,  color = {r = 0.835294, g = 0.0784314, b = 0, a = 1},  editingLocked = false,  treeItemIsExpanded = false,  localizationKey = 'FLYNOTE_06_MOLINARI_RUNAWAY_2',  font = 'Data/Fonts/Options.fnt',  height = 42,  boundsX = 300,  boundsY = 100,  },
	}
	return objects
end
