class 'M3AimItem' (M3Item)
-------------------------------------------------------------------------------

function M3AimItem:__init(id, name, pTimer)
    M3Item.__init(self, id, name, pTimer)
    
    self.bCombinable = false
    self.bChargeable = false
    self.bShufflable = false
    self.bExplodable = false
    self.bPassable   = true
    
    self.returnZAction = nil
    
    self:_createGlow()
end
-------------------------------------------------------------------------------

function M3AimItem:destroy()
    if self.returnZAction then
        self.returnZAction:kill()
        self.returnZAction = nil
    end
    
    if self.glow then
        if current_scene:getPlayField() then
            self.glow:setRespondable(true)           
        end
        self.glow:destroy()
        self.glow = nil
    end
    
    M3Item.destroy(self)
end
-------------------------------------------------------------------------------

function M3AimItem:pass()
    self.bFalling  = false
    
    local scrX = self.anchor:getScrX()
    local scrY = self.anchor:getScrY()
    
    self.anchor:attachTo(current_scene:getPlayField():getMainEntity())
    self.anchor:setOrder(200)
    self.anchor:setScrXY(scrX, scrY)
    
    self.anchor:Move(0, M3Cell.CELL_SIZE, M3Item.MOVE_TIME)
end
-------------------------------------------------------------------------------

function M3AimItem:helpAnimate(time)
    if self.spriteEffector or self.spriteAction then
        return false
    end
    
    local pos = Vector2f(self.sprite:getX(), self.sprite:getY())
    self.spriteEffector = self:_createRotateEffector()
    
    self:addAnchorZ(M3Field.HINT_Z)
    self.returnZAction = self.pTimer:add(function()
                                            self.returnZAction = nil
                                            self:addAnchorZ(-M3Field.HINT_Z)
                                         end,
                                         time)
    
    self.spriteAction = self.pTimer:add(function()
                                            self.spriteAction = nil
                                            self.spriteEffector:destroy()
                                            self.spriteEffector = nil
                                            
                                            self.spriteEffector = self.sprite:MoveTo(pos.x, pos.y, time * 0.1)
                                            self.spriteAction = self.pTimer:add(function()
                                                                                    self.spriteAction = nil
                                                                                    self.spriteEffector:destroy()
                                                                                    self.spriteEffector = nil
                                            
                                                                                    self.sprite:setX(pos.x)
                                                                                    self.sprite:setY(pos.y)
                                                                                end,
                                                                                time * 0.1)
                                        end,
                                        time * 0.9)
    
    return true
end
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
-- PRIVATE
-------------------------------------------------------------------------------

function M3AimItem:_createGlow()
    local texture    = M3Game.TEXTURE_PATH..'aimGlow.png'
	local objectName = 'aimGlow'..tostring(self.id)..'_'..tostring(self.uniqueId)
	
	--local anim = CreateAnimation(texture,0,0,20,22,23,24)
    local anim = CreateSpriteEntity(texture)
    anim:setAnimationSize(20, 22)
	anim:setHotSpot(10,11)
    anim:setFPS(24)
    anim:setFramesCount(23)
    anim:setXY(0, 0)
    anim:setOrder(3)
    anim:setScale(4)
	anim:attachTo(self.anchor)
    anim:setRespondable(false)
    anim:setMode(_ANIM_LOOP)
    	
	self.glow = anim	
	self.glow:play()
end
-------------------------------------------------------------------------------