class 'l_08_Lauras_room_Z_Door_to_shop' (ZoomZone)

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

self:entityHide('zd_open','zd_ajar')
	-- some thing ---------------------------------------------------------
	do
		local function on_something(event)
			self:closeAndDisable()
		end		
	end
	-----------------------------------------------------------------------

end

function l_08_Lauras_room_Z_Door_to_shop:onOpen()

		local time = 0.1
   	   	


	if not self.playfield:isObjectClicked('area_click_shelf') then	
		if save then
			self:shake_door_z()
        else
	       	self.timer:add( function() self:shake_door_z() end, time)
        end
	else
		self:entityHide('zd_chair')

	end
end

function l_08_Lauras_room_Z_Door_to_shop:shake_door_z()
 	local zeffector = nil 
	 
    local zsx = self:getEntityNamed('zd_close'):getX() -- запоминаем начальную позицыю
    local zsy = self:getEntityNamed('zd_close'):getY()
    local zsa = self:getEntityNamed('zd_close'):getRotationDeg()
    local zdx = 2/1.5
    local zdy = 2/4
    local zda = 1/360
    zeffector = CreateAnimationEffector()
    zeffector:attachTo(self:getEntityNamed('zd_close'))
    zeffector:setDestroysOnEnd(true)				
	zeffector:setMode(_ANIM_LOOP)
	zeffector:setLifeTime(0, 5.95833333333333)
	zeffector:setKey(_TRACK_X, 0.375, zsx) 
	zeffector:setKey(_TRACK_Y, 0.375, zsy) 
	zeffector:setKey(_TRACK_X, 0.41666666666667, zsx)
	zeffector:setKey(_TRACK_Y, 0.41666666666667, zsy)
	zeffector:setKey(_TRACK_X, 0.45833333333333, zsx)
	zeffector:setKey(_TRACK_Y, 0.45833333333333, zsy)
	zeffector:setKey(_TRACK_X, 0.66666666666667, zsx)
	zeffector:setKey(_TRACK_Y, 0.66666666666667, zsy)
	zeffector:setKey(_TRACK_X, 0.70833333333333, zsx + zdx)
	zeffector:setKey(_TRACK_Y, 0.70833333333333, zsy + zdy)
	zeffector:setKey(_TRACK_X, 0.75, zsx)
	zeffector:setKey(_TRACK_Y, 0.75, zsy)
	zeffector:setKey(_TRACK_X, 0.95833333333333, zsx)
	zeffector:setKey(_TRACK_Y, 0.95833333333333, zsy)
	zeffector:setKey(_TRACK_X, 1, zsx)
	zeffector:setKey(_TRACK_Y, 1, zsy)
	zeffector:setKey(_TRACK_X, 1.04166666666667, zsx)
	zeffector:setKey(_TRACK_Y, 1.04166666666667, zsy)
	zeffector:setKey(_TRACK_X, 1.25, zsx)
	zeffector:setKey(_TRACK_Y, 1.25, zsy)
	zeffector:setKey(_TRACK_X, 1.29166666666667, zsx + zdx)
	zeffector:setKey(_TRACK_Y, 1.29166666666667, zsy + zdy)
	zeffector:setKey(_TRACK_X, 1.33333333333333, zsx)
	zeffector:setKey(_TRACK_Y, 1.33333333333333, zsy)
	zeffector:setKey(_TRACK_X, 3.54166666666667, zsx)
	zeffector:setKey(_TRACK_Y, 3.54166666666667, zsy)
	zeffector:setKey(_TRACK_X, 3.58333333333333, zsx + zdx)
	zeffector:setKey(_TRACK_Y, 3.58333333333333, zsy + zdy)
	zeffector:setKey(_TRACK_X, 3.625, zsx)
	zeffector:setKey(_TRACK_Y, 3.625, zsy)
	zeffector:setKey(_TRACK_X, 3.83333333333333, zsx)
	zeffector:setKey(_TRACK_Y, 3.83333333333333, zsy)
	zeffector:setKey(_TRACK_X, 3.875, zsx + zdx)
	zeffector:setKey(_TRACK_Y, 3.875, zsy + zdy)
	zeffector:setKey(_TRACK_X, 3.91666666666667, zsx)
	zeffector:setKey(_TRACK_Y, 3.91666666666667, zsy)
	zeffector:setKey(_TRACK_X, 4.125, zsx)
	zeffector:setKey(_TRACK_Y, 4.125, zsy)
	zeffector:setKey(_TRACK_X, 4.16666666666667, zsx + zdx)
	zeffector:setKey(_TRACK_Y, 4.16666666666667, zsy + zdy)
	zeffector:setKey(_TRACK_X, 4.20833333333333, zsx)
	zeffector:setKey(_TRACK_Y, 4.20833333333333, zsy)
	zeffector:setKey(_TRACK_X, 4.41666666666667, zsx)
	zeffector:setKey(_TRACK_Y, 4.41666666666667, zsy)
	zeffector:setKey(_TRACK_X, 4.45833333333333, zsx + zdx)
	zeffector:setKey(_TRACK_Y, 4.45833333333333, zsy + zdy)
	zeffector:setKey(_TRACK_X, 4.5, zsx)
	zeffector:setKey(_TRACK_Y, 4.5, zsy)
				
	if not self.playfield:isObjectClicked('area_click_shelf') then	
        zeffector:play()
    else		
		--zeffector:destroy()
	end			
end

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

function l_08_Lauras_room_Z_Door_to_shop:CreateLoaderTable()
	local objects =
	{
		{ name = 'zd_bg',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Door_to_shop/zd_bg.jpg',  width = 640,  height = 480,  },
		{ name = 'zd_ajar',  entityType = 'SpriteEntity',  x = 512,  y = 384,  order = 0,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Door_to_shop/zd_ajar.png',  width = 392,  height = 480,  },
		{ name = 'zd_open',  entityType = 'SpriteEntity',  x = 466,  y = 384,  order = 2,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Door_to_shop/zd_open.png',  width = 548,  height = 480,  },
		{ name = 'zd_close',  entityType = 'SpriteEntity',  x = 522,  y = 384,  order = 4,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Door_to_shop/zd_close.png',  width = 356,  height = 480,  },
		{ name = 'zd_chair',  entityType = 'SpriteEntity',  parentName = 'zd_close',  x = 145,  y = 155,  order = 4,  editingLocked = false,  treeItemIsExpanded = false,  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Door_to_shop/zd_chair.png',  width = 324,  height = 168,  },
		{ name = 'zd_handle',  entityType = 'SpriteEntity',  parentName = 'zd_close',  x = 126,  y = 111,  order = 8,  editingLocked = false,  treeItemIsExpanded = false,  hotSpot = {x = 92, y = 16},  texturePath = 'Data/Textures/Scenes/08_Lauras_room/Z_Door_to_shop/zd_handle.png',  width = 114,  height = 48,  },
		{ name = 'area_click_handle',  entityType = 'SpriteEntity',  x = 648.5,  y = 498.5,  order = 60,  scaleX = 3.39,  scaleY = 3.82,  color = {r = 1, g = 1, b = 1, a = 0.00392157},  editingLocked = false,  treeItemIsExpanded = false,  hotSpot = {x = 85, y = 74},  width = 100,  height = 100,  },
	}
	return objects
end
