dofile('data/Scripts/scenes/06_garden/anim/06_garden_hp_anim_z_web.lua')

class 'l_06_garden_hp_z_web' (ZoomEventHandler)

function l_06_garden_hp_z_web:__init(name)
    ZoomEventHandler.__init(self, name)
    self.zone.mgHelpText = 'HELP_06_HP_MMG_WEB'
    
    self.zone.anim = AnimationBundle(Loader_06_HP_Zoom_Web_Animations(Object('z_web_bg')))
    
    self.DOTS_COUNT         = 7
    self.SELECTOR_FADE_TIME = 0.2
    self.ROTATE_TIME        = 0.2
    self.RESET_TIME         = 0.5
    self.MOVE_SPEED         = 250
    
    self.webs        = {}
    self.dots        = {}
    self.spider      = nil
    self.spiderPos   = nil
    self.spiderState = 'stay'
    -------------------------
    
    self.reset = ScriptCreateButton( Object('z_mill_reset'), 'Button_reset', play_field:GetLevelScreen() )
    self.reset:AttachTo(Object('z_web_bg'))
    self.reset:SetZ(50)
    self.reset:SetX(0)
    self.reset:SetY(200)
    -------------------------
    
    ObjectVisible('area_find_fly', false)
    -------------------------
    
    self:initDots()
    self:pushWeb('2_7', 'z_web_part_1')
    self:pushWeb('6_7', 'z_web_part_2')
    self:pushWeb('1_2', 'z_web_part_3')
    self:pushWeb('2_5', 'z_web_part_4')
    self:pushWeb('5_6', 'z_web_part_5')
    self:pushWeb('2_3', 'z_web_part_6')
    self:pushWeb('1_3', 'z_web_part_7')
    self:pushWeb('3_5', 'z_web_part_8')
    self:pushWeb('3_4', 'z_web_part_9')
    self:pushWeb('4_5', 'z_web_part_10')
    
    self:initSpider()
    self:normalizeLines()
    self:updateDotsGlow()
    
    self.reset:Hide()
    
    if self:isAllWebsVisible() then
        self.level.timer:Add(   function()
                                    self:onComplete(true)
                                end, 0)
    end
end
-----------------------------

function l_06_garden_hp_z_web:pushWeb(key, objectName)
    local visible = HasGameState('SCENE_06HP_WEB_VISIBLE_'..key, 'true')
    ObjectOpacity(objectName, visible and 1 or 0)
    
    do
        local name   = 'line_'..key
        local anim   = CreateAnimationByTextureName('data/Texture/Scenes/06_garden/hp/z_web/z_web_line.png')
        local object = play_field:CreateObject(name,anim,0,0,0,0,1,1)
        object:GetAnimation():SetHotSpot(0, object:GetAnimation():GetHeight()/2)
        self.zone:AddObject(name)
        
        object:SetZ(51)
    end
    
    local info   = {}
    info.key     = key
    info.object  = Object(objectName)
    info.line    = Object('line_'..key)
    info.visible = visible
    
    self.webs[key] = info
    
    do
        local dividerPos = string.find(key, '_')
        local id1 = tonumber(string.sub(key, 1, dividerPos-1))
        local id2 = tonumber(string.sub(key, dividerPos+1))
        
        self.dots[id1].links[id2] = self.dots[id2]
        self.dots[id2].links[id1] = self.dots[id1]
        
        do
            local dx  = self.dots[id2].x - self.dots[id1].x
            local dy  = self.dots[id2].y - self.dots[id1].y
            local len = math.sqrt(dx*dx + dy*dy)
            local scale = len/info.line:GetAnimation():GetWidth()
            local angle = math.atan2(dy, dx)
            
            info.line:SetX(self.dots[id1].x)
            info.line:SetY(self.dots[id1].y)
            info.line:SetScaleX(scale)
            info.line:SetAngle(angle)
            info.line:SetVisible(visible)
        end
    end
end
-----------------------------

function l_06_garden_hp_z_web:getWebId(id1, id2)
    return math.min(id1, id2)..'_'..math.max(id1, id2)
end
-----------------------------

function l_06_garden_hp_z_web:getWeb(id1, id2)
    local key = self:getWebId(id1, id2)
    return self.webs[key]
end
-----------------------------

function l_06_garden_hp_z_web:setWebVisible(key, visible, time)
    local web = self.webs[key]
    local opacity = visible and 1 or 0
    
    if web.effector then
        web.effector:Destroy()
        web.effector = nil
    end
    
    web.visible = visible
    web.effector = web.object:ChangeOpacity(web.object:GetOpacity(), opacity, time)
    web.effector:SetDestroysOnEnd(false)
    
    SetGameState('SCENE_06HP_WEB_VISIBLE_'..key, tostring(visible))
end
-----------------------------

function l_06_garden_hp_z_web:isAllWebsVisible()
    for key, web in pairs(self.webs) do
        if not web.visible then
            return false
        end
    end
    
    return true
end
-----------------------------

function l_06_garden_hp_z_web:initDots()
    local function on_click_dot(e)
        if e.save then
            return
        end
        
        local targetId = tonumber(string.sub(e.target, string.len('area_click_dot_') + 1))
        self:moveSpider(targetId)
    end
    ---------------------
    
    for i=1, self.DOTS_COUNT do
        local selectorName = 'z_web_selector_'..i
        local selector     = Object(selectorName)
        local area         = nil
        
        local x = selector:GetX()
        local y = selector:GetY()
        
        do
            local areaName = 'area_click_dot_'..i
            local anim = CreateAnimation('data/Texture/Common/area_round.png',0,0,128,128,1,0)
            anim:SetHotSpot(64,64)
            anim:SetBlendMode(2)
            anim:SetColor('0x01FFFFFF')
            area = play_field:CreateObject(areaName,anim,0,0,0,0,1,1)
            self.zone:AddObject(areaName)
            
            area:SetZ(100)
            area:SetX(x)
            area:SetY(y)
            
            RegisterActiveObject(areaName, on_click_dot, true)
        end
        
        do
            local name   = 'dotGlow_'..i
            local radius = 15
            
            local anim   = CreateAnimationByTextureName('data/Texture/Common/area_round.png')
            local object = play_field:CreateObject(name,anim,0,0,0,0,1,1)
            self.zone:AddObject(name)
            
            object:SetZ(52)
            object:SetX(x)
            object:SetY(y)
            object:SetScale(radius/object:GetAnimation():GetWidth())
            object:SetVisible(false)
        end
        
        area:SetVisible(false)
        selector:SetOpacity(0)
        
        local info = {}
        info.id = i
        info.x  = x
        info.y  = y
        info.selector = selector
        info.area = area
        info.glow = Object('dotGlow_'..i)
        info.links = {}
        
        self.dots[i] = info
    end
end
-----------------------------

function l_06_garden_hp_z_web:setLinksVisible(id, visible)
    local dot = self.dots[id]
    
    for dotId, nearDot in pairs(dot.links) do
        nearDot.area:SetVisible(visible)
    end
end
-----------------------------

function l_06_garden_hp_z_web:initSpider()
    self.spider    = Object('z_web_spider')
    self.spiderPos = HasGameState('SCENE_06HP_SPIDER_POS') and tonumber(GetGameState('SCENE_06HP_SPIDER_POS'):Get(0)) or 2
    self.spiderAngle = M_PI_OVER_2
    
    self.spider:GetAnimation():SetMode(HGEANIM_FWD + HGEANIM_LOOP)
    self.spider:GetAnimation():Stop()
    
    local dot = self.dots[self.spiderPos]
    self.spider:SetXY(dot.x, dot.y)
    self.spider:SetAngle(-M_PI_OVER_2 + self.spiderAngle)
    
    self.spiderState = 'stay'
    
    self:setLinksVisible(self.spiderPos, true)
end
-----------------------------

function l_06_garden_hp_z_web:moveSpider(targetId, bIgnoreWeb)
    self:setLinksVisible(self.spiderPos, false)
    
    local targetDot  = self.dots[targetId]
    local currentDot = self.dots[self.spiderPos]
    local web        = self:getWeb(targetId, self.spiderPos)
    local dx, dy
    
    if targetDot == currentDot then
        dx = targetDot.selector:GetX() - self.spider:GetX()
        dy = targetDot.selector:GetY() - self.spider:GetY()
    else
        dx = targetDot.selector:GetX() - currentDot.selector:GetX()
        dy = targetDot.selector:GetY() - currentDot.selector:GetY()
    end
    
    local angle = math.atan2(dy, dx)
    local dA    = angle - self.spider:GetAngle()
    
    if math.abs(dA) > M_PI then
        local dir = self.spider:GetAngle() / math.abs(self.spider:GetAngle())
        dA = dir * (M_TWO_PI - math.abs(dA))
    end
    
    local dist     = math.sqrt(dx*dx + dy*dy)
    local moveTime = dist/self.MOVE_SPEED
    
    self.spiderPos = targetId
    SetGameState('SCENE_06HP_SPIDER_POS', tostring(targetId))
    
    self.spider:GetAnimation():Play()
    self.spider:Rotate(dA + self.spiderAngle, self.ROTATE_TIME)
    self.spiderState = 'rotate'
    
    self.rotateAction = GetCurrentLevel().timer:Add(function()
                                                        self.rotateAction = nil
                                                        
                                                        self.spider:MoveTo(targetDot.x, targetDot.y, moveTime)
                                                        self.spiderState = 'move'
                                                        
                                                        if not self.sound_spider_loop then
                                                            self.sound_spider_loop = MakeSoundEntity('06_hp_spider_loop')
                                                        end
                                                        self.sound_spider_loop:PlaySound(true)
                                                        
                                                        if not bIgnoreWeb then
                                                            self:setWebVisible(web.key, not web.visible, moveTime)
                                                            self:setLineVisible(currentDot.id, targetDot.id, web.visible, moveTime)
                                                            
                                                            local currentDotGlowVisible = self:hasDotVisibleLinks(currentDot.id)
                                                            local targetDotGlowVisible  = self:hasDotVisibleLinks(self.spiderPos, currentDot.id)
                                                            
                                                            currentDot.glow:SetVisible(currentDotGlowVisible)
                                                            self.dots[self.spiderPos].glow:SetVisible(targetDotGlowVisible)
                                                        end
                                                        
                                                        self.moveAction = GetCurrentLevel().timer:Add(  function()
                                                                                                            self.moveAction = nil
                                                                                                            
                                                                                                            self.spider:GetAnimation():Stop()
                                                                                                            self.spider:GetAnimation():SetFrame(0)
                                                                                                            
                                                                                                            self.sound_spider_loop:StopSound()
                                                                                                            self.spiderState = 'stay'
                                                                                                            
                                                                                                            if not bIgnoreWeb then
                                                                                                                web.line:SetVisible(web.visible)
                                                                                                            end
                                                                                                            
                                                                                                            self:normalizeLines()
                                                                                                            self:updateDotsGlow()
                                                                                                            
                                                                                                            if self:isAllWebsVisible() then
                                                                                                                self:onComplete(false)
                                                                                                            else
                                                                                                                self:setLinksVisible(self.spiderPos, true)
                                                                                                            end
                                                                                                        end,
                                                                                                        moveTime)
                                                    end,
                                                    self.ROTATE_TIME)
    
    return self.ROTATE_TIME + moveTime
end
-----------------------------

function l_06_garden_hp_z_web:normalizeLines()
    local curDot = self.dots[self.spiderPos]
    
    for dotId, dot in pairs(curDot.links) do
        local web = self:getWeb(self.spiderPos, dotId)
        
        local dx  = self.dots[dotId].x - self.dots[self.spiderPos].x
        local dy  = self.dots[dotId].y - self.dots[self.spiderPos].y
        local len = math.sqrt(dx*dx + dy*dy)
        local scale = len/web.line:GetAnimation():GetWidth()
        local angle = math.atan2(dy, dx)
        
        web.line:SetX(self.dots[self.spiderPos].x)
        web.line:SetY(self.dots[self.spiderPos].y)
        web.line:SetScaleX(scale)
        web.line:SetAngle(angle)
    end
end
-----------------------------

function l_06_garden_hp_z_web:setLineVisible(fromDotId, toDotId, bVisible, time)
    local dot1 = bVisible and self.dots[fromDotId] or self.dots[toDotId]
    local dot2 = bVisible and self.dots[toDotId]   or self.dots[fromDotId]
    local web  = self:getWeb(fromDotId, toDotId)
    
    local dx    = dot2.x - dot1.x
    local dy    = dot2.y - dot1.y
    local len   = math.sqrt(dx*dx + dy*dy)
    local scale = len/web.line:GetAnimation():GetWidth()
    local angle = math.atan2(dy, dx)
    
    web.line:SetX(dot1.x)
    web.line:SetY(dot1.y)
    web.line:SetAngle(angle)
    
    local startScale = bVisible and 0 or scale
    local finalScale = bVisible and scale or 0
    
    if web.lineEffector then
        web.lineEffector:Destroy()
        web.lineEffector = nil
    end
    
    web.lineEffector = web.line:ChangeScaleX(startScale, finalScale, time)
    web.lineEffector:SetDestroysOnEnd(false)
    
    web.line:SetVisible(true)
end
-----------------------------

function l_06_garden_hp_z_web:resetWeb()
    if self.rotateAction then
        self.rotateAction:Kill()
        self.rotateAction = nil
    end
    
    if self.moveAction then
        self.moveAction:Kill()
        self.moveAction = nil
        
        self.sound_spider_loop:StopSound()
    end
    
    self.spider:GetAnimation():Stop()
    self.spider:GetAnimation():SetFrame(0)
    self.spiderState = 'stay'
    
    for key, web in pairs(self.webs) do
        self:setWebVisible(key, false, self.RESET_TIME)
        
        if web.lineEffector then
            web.lineEffector:Destroy()
            web.lineEffector = nil
        end
        
        web.line:SetVisible(false)
    end
    
    for id, dot in pairs(self.dots) do
        dot.glow:SetVisible(false)
    end
    
    local time = self:moveSpider(2, true)
    
    if not self.sound_reset then
        self.sound_reset = MakeSoundEntity('06_hp_reset')
    end
    
    self.sound_reset:StopSound()
    self.sound_reset:PlaySound(false)
    
    self.reset:SetActive(false)
    GetCurrentLevel().timer:Add(function()
                                    self.reset:SetActive(true)
                                end,
                                time)
end
-----------------------------

function l_06_garden_hp_z_web:onComplete(save)
    self:setLinksVisible(self.spiderPos, false)
    self.reset:Hide()
    
    ObjectOpacity('z_web_part_4', 0)
    ObjectOpacity('z_web_part_6', 0)
    ObjectOpacity('z_web_part_8', 0)
    
    self.sound_fly_idle = MakeSoundEntity('06_hp_fly_in_net')
    
    if not HasActionCompletedState('webMMGCompleted') then
        AddActionCompletedState('webMMGCompleted')
    end

    if save then
        self.zone.anim:PlayAnimation('idle')
        self.sound_fly_idle:SetVolume(0)
        self.sound_fly_idle:PlaySound(true)
        
        ObjectVisible('area_find_fly', true)
    else
        self.zone.anim:PlayAnimation('fly')
        MakeSoundEntity('06_hp_fly'):PlaySound(false)
        GetCurrentLevel():GetPanelLuaObject():SetMode( EPanelMode.PM_HIDDENPICTURE )
        
        GetCurrentLevel().timer:Add(function()
                                        self.zone.anim:StopAnimation('fly')
                                        self.zone.anim:PlayAnimation('idle')
                                        
                                        self.sound_fly_idle:SetVolume(1)
                                        self.sound_fly_idle:PlaySound(true)
                                        
                                        ObjectVisible('area_find_fly', true)
                                    end,
                                    self.zone.anim:GetAnimation('fly'):GetDuration())
    end
end
-----------------------------

function l_06_garden_hp_z_web:onDotEnter(dot)
    if dot.selectorEffector then
        dot.selectorEffector:Destroy()
    end
    
    dot.selectorEffector = dot.selector:ChangeOpacity(dot.selector:GetOpacity(), 1, self.SELECTOR_FADE_TIME)
    dot.selectorEffector:SetDestroysOnEnd(false)
end
-----------------------------

function l_06_garden_hp_z_web:onDotLeave(dot)
    if dot.selectorEffector then
        dot.selectorEffector:Destroy()
    end
    
    dot.selectorEffector = dot.selector:ChangeOpacity(dot.selector:GetOpacity(), 0, self.SELECTOR_FADE_TIME)
    dot.selectorEffector:SetDestroysOnEnd(false)
end
-----------------------------

function l_06_garden_hp_z_web:OnObjectMouseEnter(object)
    local objectName = object:GetName()
    
    for id, dot in ipairs(self.dots) do
        if dot.area:GetName() == objectName then
            self:onDotEnter(dot)
            return
        end
    end
end
-----------------------------

function l_06_garden_hp_z_web:OnObjectMouseLeave(object)
    local objectName = object:GetName()
    
    for id, dot in ipairs(self.dots) do
        if dot.area:GetName() == objectName then
            self:onDotLeave(dot)
            return
        end
    end
end
-----------------------------

function l_06_garden_hp_z_web:OnButtonPress(title)
	if title == 'Button_reset' then
	   -- if self.spiderState == 'stay' then
	        self:resetWeb()
	   -- else
	   --     ShowBlackBar('BBT_06HP_CANNOT_RESET')
	   -- end
	end
end
-----------------------------

function l_06_garden_hp_z_web:SkipMiniGame()
    if self.rotateAction then
        self.rotateAction:Kill()
        self.rotateAction = nil
    end
    
    if self.moveAction then
        self.moveAction:Kill()
        self.moveAction = nil
        
        self.sound_spider_loop:StopSound()
    end
    
    self.spider:DestroyEffectors()
    self.spider:GetAnimation():Stop()
    self.spider:GetAnimation():SetFrame(0)
    self.spiderState = 'stay'
    
    self:setLinksVisible(self.spiderPos, false)
    self.reset:Hide()
    
    local time = 0.5
    
    for key, web in pairs(self.webs) do
        self:setWebVisible(key, true, time)
        
        local dividerPos = string.find(key, '_')
        local id1 = tonumber(string.sub(key, 1, dividerPos-1))
        local id2 = tonumber(string.sub(key, dividerPos+1))
        
        if web.lineEffector then
            web.lineEffector:Destroy()
            web.lineEffector = nil
        end
        
        do
            local dx  = self.dots[id2].x - self.dots[id1].x
            local dy  = self.dots[id2].y - self.dots[id1].y
            local len = math.sqrt(dx*dx + dy*dy)
            local scale = len/web.line:GetAnimation():GetWidth()
            local angle = math.atan2(dy, dx)
            
            web.line:SetX(self.dots[id1].x)
            web.line:SetY(self.dots[id1].y)
            web.line:SetScaleX(scale)
            web.line:SetAngle(angle)
            web.line:SetVisible(true)
        end
    end
    
    for id, dot in pairs(self.dots) do
        dot.glow:SetVisible(true)
    end
    
    GetCurrentLevel().mouseBlocker:Push()
    GetCurrentLevel().timer:Add(function()
                                    GetCurrentLevel().mouseBlocker:Pop()
                                    self:onComplete(false)
                                end,
                                time)
end
-----------------------------

function l_06_garden_hp_z_web:hasDotVisibleLinks(id, ignoreDotId)
    local dot = self.dots[id]
    
    for linkedDotId, linkedDot in pairs(dot.links) do
        
        if linkedDotId ~= ignoreDotId then
            local web = self:getWeb(id, linkedDotId)
            
            if web.visible then
                return true
            end
        end
    end
    
    return false
end
-----------------------------

function l_06_garden_hp_z_web:updateDotsGlow()
    for id, dot in pairs(self.dots) do
        local visible = (id == self.spiderPos and HasActionCompletedState('SpiderPlaced'))
        
        if not visible then
            for linkedDotId, linkedDot in pairs(dot.links) do
                local web = self:getWeb(id, linkedDotId)
                
                if web.visible then
                    visible = true
                    break
                end
            end
        end
        
        dot.glow:SetVisible(visible)
    end
end
-----------------------------

--------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function l_06_garden_hp_z_web:LoadData(screen)
	local anim
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/z_web_bg.jpg',0,0,640,480,1,0)
	anim:SetHotSpot(320,240)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_bg',anim,512,384,50,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area_round.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_find_fly',anim,516,349,100,0,2,2)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/z_web_way.png',0,0,578,400,1,0)
	anim:SetHotSpot(289,200)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_way',anim,515,341,60,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_1.png',0,0,136,124,1,0)
	anim:SetHotSpot(68,62)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_1',anim,449,205,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_2.png',0,0,190,194,1,0)
	anim:SetHotSpot(95,97)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_2',anim,563,237,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_3.png',0,0,120,152,1,0)
	anim:SetHotSpot(60,76)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_3',anim,324,286,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_4.png',0,0,300,186,1,0)
	anim:SetHotSpot(150,93)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_4',anim,531,321,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_5.png',0,0,184,136,1,0)
	anim:SetHotSpot(92,68)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_5',anim,680,311,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_6.png',0,0,176,242,1,0)
	anim:SetHotSpot(88,121)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_6',anim,426,356,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_7.png',0,0,130,214,1,0)
	anim:SetHotSpot(65,107)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_7',anim,390,443,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_8.png',0,0,128,124,1,0)
	anim:SetHotSpot(64,62)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_8',anim,516,421,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_9.png',0,0,160,118,1,0)
	anim:SetHotSpot(80,59)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_9',anim,528,488,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/webs/z_web_part_10.png',0,0,128,138,1,0)
	anim:SetHotSpot(64,69)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_part_10',anim,642,449,63,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/z_web_spider.png',0,0,133,146,12,24)
	anim:SetHotSpot(66,73)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_spider',anim,134,276,70,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/selectors/z_web_selector_1.png',0,0,108,116,1,0)
	anim:SetHotSpot(69,45)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_selector_1',anim,329,389,64,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/selectors/z_web_selector_2.png',0,0,84,90,1,0)
	anim:SetHotSpot(49,54)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_selector_2',anim,382,227,64,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/selectors/z_web_selector_3.png',0,0,76,98,1,0)
	anim:SetHotSpot(35,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_selector_3',anim,452,477,64,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/selectors/z_web_selector_4.png',0,0,100,62,1,0)
	anim:SetHotSpot(44,33)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_selector_4',anim,606,516,64,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/selectors/z_web_selector_5.png',0,0,120,98,1,0)
	anim:SetHotSpot(51,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_selector_5',anim,683,378,64,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/selectors/z_web_selector_6.png',0,0,128,106,1,0)
	anim:SetHotSpot(63,69)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_selector_6',anim,656,245,64,0,1,1)
	
	anim = CreateAnimation('data/Texture/Scenes/06_garden/hp/z_web/selectors/z_web_selector_7.png',0,0,104,104,1,0)
	anim:SetHotSpot(51,52)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('z_web_selector_7',anim,526,195,64,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area_round.png',0,0,128,128,1,0)
	anim:SetHotSpot(64,64)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_drop_spider',anim,512,352,100,0,4,3)
	
end
-- CLEAR_ON_SAVE_END
