class 'l_09_Blood' (LevelEventHandler)
dofile('data/Scripts/minigames/09_Blood/09_Blood_anim.lua')

function l_09_Blood:__init(name)
	LevelEventHandler.__init(self, name)
	
	self:GetPanelLuaObject():SetMode(EPanelMode.PM_MINIGAME) 
	
	self:RegisterToolFindMG('09_scheme')
	
	-- animations 
	self.all_anims = AnimationBundle(GetMinigame09BloodAnimationsLoader(Object('Background')))
    self.all_anims:PlayAnimation('fon_anim')
    
    -- sounds
    self.sound_appear_list = MakeSoundEntity('09_mg_appear_list')
	self.sound_move_items = MakeSoundEntity('09_mg_move_items')
	self.sound_right_place = MakeSoundEntity('09_mg_right_place')
--	self.sound_appear_list:PlaySound(false)
	
	-- places
	--		1		2					8		9
	--	3		4		5			10		11		12
	--		6		7					13		14
	
	-- items
	-- yellow - 1
	-- red - 2
	-- green - 3
	-- blue - 4
	-- orange - 5
	
	self.CountObjects = 12
	self.TimeMove = 0.3
	self.TimeOpacity = 0.5
	self.RightItemPlace = {{1, 2}, {2, 5}, {3, 7}, {4, 6}, {5, 3}, {7, 8}, {8, 9}, {9, 12}, {10, 14}, {11, 13} } -- num 1 - num item, num 2 - right num place
	self.PlacesPos = {} -- koord places
	for i = 1, 14 do
		self.PlacesPos[i] = {Object('area_place_'..i):GetX(), Object('area_place_'..i):GetY()}
	end
	self.NeighboursItems = { -- индекс - номер места, значения - номера мест, на которые можно двигать итем с данного места
								{2, 3, 4}, 				-- 1
								{1, 4, 5}, 				-- 2
								{1, 4, 6}, 				-- 3
								{1, 2, 3, 5, 6, 7}, 	-- 4
								{2, 4, 7}, 				-- 5
								{3, 4, 7}, 				-- 6
								{4, 5, 6}, 				-- 7
								
								{9, 10, 11}, 			-- 8
								{8, 11, 12}, 			-- 9
								{8, 11, 13}, 			-- 10
								{8, 9, 10, 12, 13, 14}, -- 11
								{9, 11, 14}, 			-- 12
								{10, 11, 14}, 			-- 13
								{11, 12, 13}  			-- 14
							}
	
	-- save
	self.Save_state_mg = '09_Blood_SaveLoad'
	self.ArrayForSaveMG = {}
	self.ArrayForSaveMG.PlaceItem = { 3, 6, 4, 0, 5, 2, 1,    10, 12, 9, 0, 11, 8, 7 } -- index - place, value - item  										
	self.ArrayForSaveMG.ItemPlace = { 7, 6, 1, 3, 5, 2,   14, 13, 10, 8, 12, 9 } -- index - item, value - place  
	self.ArrayForSaveMG.EmptyPlaces = {4, 11} -- index - num circle, value - num empty place
	self.ArrayForSaveMG.Completed = false

	-- restore
	if HasGameState(self.Save_state_mg) then
		self.ArrayForSaveMG = Helpers.RestoreObjectFromGameState(self.Save_state_mg)  
	end
	
	-- attach table
	Helpers.AttachInPlace(Object('Table_2'), Object('Table'))
	
	
	for i = 1, self.CountObjects do
		-- attach parts to plates
		Helpers.AttachInPlace(Object('Item_'..i), Object('Plate_'..i))
		-- ignore
		play_field:IgnoreOnTestPoint('Item_'..i)
		-- cursor
		GetCurrentLevel().ignore_on_highlight['Plate_'..i] = true
		GetCurrentLevel().custom_cursors['Plate_'..i] = 'CursorActive'
		-- set items on their places according table self.ArrayForSaveMG.ItemPlace
		Object('Plate_'..i):SetXY(self.PlacesPos[self.ArrayForSaveMG.ItemPlace[i]][1], self.PlacesPos[self.ArrayForSaveMG.ItemPlace[i]][2])
	end
	
	-- light
	for i = 1, 5 do
		Object('Light_'..i):SetVisible(false)
	end
	self:SetLightOff(false, true)
	
	self:IgnoreObjectMG(true)
	if not self.ArrayForSaveMG.Completed then
		Object('area_final_click'):SetVisible(false)
		Object('Bg_Bloor'):SetOpacity(0)
		Object('Table'):SetXY(Object('Table'):GetX(), Object('Table'):GetY() - 415)
		self:IgnoreObjectMG(false)		
	else
		self:IgnoreObjectMG(true)
		self:GetPanelLuaObject():SetMode(EPanelMode.PM_QUEST)
		Object('Plate_6'):SetZ(205)
		Object('Plate_12'):SetZ(205) 
		-- text
		tf = CreateTextEntity(NEWSPAPER_FONT, 'BBT_09_FINAL_MESSAGE')
		tf:SetXY(-7+232, 0+204-125)
		tf:SetZ(192)
		tf:SetScale(1.3)
		tf:AttachTo(Object('Table'))
		tf:SetTracking(-1)
		tf:SetSpacing(0.6)
		tf:SetBorderSize(320, 100)
		tf:SetColor('0xFF000088')
		tf:SetTextAlignment(HGETEXT_CENTER + HGETEXT_MIDDLE)												
		
	end	
	
	
	
	-- click on final table
	local function on_click_final_table(event)
		Object('area_final_click'):SetVisible(false)
		local time = 0.5
		Helpers.AttachInPlace(Object('Table_2'), Object('Background'))
		
		if not event.save then
			
			local obj = Object('Table')
			Object('Table'):Rotate(math.rad(45), 0.5)
			
			local mover_start = CreateAnimationEffector()
			mover_start:AttachTo(obj)
			mover_start:SetKey(_TRACK_O, 	0.3,           	obj:GetOpacity())
			mover_start:SetKey(_TRACK_X, 	0.3,           	obj:GetX())
			mover_start:SetKey(_TRACK_Y, 	0.3,           	obj:GetY())
			mover_start:SetKey(_TRACK_SX, 	0.3,          	obj:GetScaleX())
			mover_start:SetKey(_TRACK_SY, 	0.3,          	obj:GetScaleY())

			mover_start:SetKey(_TRACK_O, 	1.2, 			0)			
			mover_start:SetKey(_TRACK_X, 	1.2,           	112)
			mover_start:SetKey(_TRACK_Y, 	1.2,           	713)
			mover_start:SetKey(_TRACK_SX, 	1.2,  			0.01)
			mover_start:SetKey(_TRACK_SY, 	1.2,  			0.01)
			mover_start:SetDestroysOnEnd(true)
			mover_start:Play()
			
			time = 1.5
		else
			Object('Table'):Hide()
		end
		
		CompleteMinigame(time)
	end
	RegisterActiveObject('area_final_click', on_click_final_table, 'CursorActive')
end

--------------------------------------------- extra functions
function l_09_Blood:IgnoreObjectMG(bool)
	if bool then
           for i = 1,self.CountObjects do
				play_field:IgnoreOnTestPoint('Plate_'..i)
		   end
	else
			-- проверка могут ли итемы двигаться на свободное место (их ли это соседи)			
			for i = 1,6 do
				local can_move = false
				for j = 1, #self.NeighboursItems[self.ArrayForSaveMG.ItemPlace[i]] do
					if self.NeighboursItems[self.ArrayForSaveMG.ItemPlace[i]][j] == self.ArrayForSaveMG.EmptyPlaces[1] then
						can_move = true
						break
					end
				end
				if can_move then
					play_field:DoNotIgnoreOnTestPoint('Plate_'..i)
				end
		   end
		   for i = 7,12 do
				local can_move = false
				for j = 1, #self.NeighboursItems[self.ArrayForSaveMG.ItemPlace[i]] do
					if self.NeighboursItems[self.ArrayForSaveMG.ItemPlace[i]][j] == self.ArrayForSaveMG.EmptyPlaces[2] then
						can_move = true
						break
					end
				end
				if can_move then
					play_field:DoNotIgnoreOnTestPoint('Plate_'..i)
				end
		   end
	end
end

function l_09_Blood:SetLightOff(bool, start)
	if bool then -- on click - off all not right items
		for i = 1, 5 do
			if self.RightItemPlace[i][2] ~= self.ArrayForSaveMG.ItemPlace[self.RightItemPlace[i][1]] or 
				self.RightItemPlace[i+5][2] ~= self.ArrayForSaveMG.ItemPlace[self.RightItemPlace[i+5][1]] then
				if Object('Light_'..i):IsVisible() then
					Object('Light_'..i):SetVisible(false)
				end
			end
		end	
	else -- on final moving - on all right items
		for i = 1, 5 do
			if self.RightItemPlace[i][2] == self.ArrayForSaveMG.ItemPlace[self.RightItemPlace[i][1]] and 
				self.RightItemPlace[i+5][2] == self.ArrayForSaveMG.ItemPlace[self.RightItemPlace[i+5][1]] then
				if not Object('Light_'..i):IsVisible() then
					Object('Light_'..i):SetVisible(true)
					if not start then
						self.sound_right_place:StopSound()
						self.sound_right_place:PlaySound(false)
					end
				end
			end
		end
	end
end

function l_09_Blood:ShowFinalList()
	Object('Plate_6'):MoveTo(self.PlacesPos[1][1], self.PlacesPos[1][2], self.TimeMove)
	Object('Plate_12'):MoveTo(self.PlacesPos[10][1], self.PlacesPos[10][2], self.TimeMove)
	local function blink_not_similar_items(name)
			self.final_blink = CreateAnimationEffector()
			self.final_blink:AttachTo(Object(name))
			self.final_blink:SetMode(_ANIM_FWD + _ANIM_NOLOOP)  
			self.final_blink:SetKey(_TRACK_SX, 0, 1)
			self.final_blink:SetKey(_TRACK_SY, 0, 1)
			self.final_blink:SetKey(_TRACK_SX, 0.5, 1.3)
			self.final_blink:SetKey(_TRACK_SY, 0.5, 1.3)
			self.final_blink:SetKey(_TRACK_SX, 1, 1)
			self.final_blink:SetKey(_TRACK_SY, 1, 1)
			self.final_blink:SetKey(_TRACK_SX, 1.5, 1.3)
			self.final_blink:SetKey(_TRACK_SY, 1.5, 1.3)
			self.final_blink:SetKey(_TRACK_SX, 2, 1)
			self.final_blink:SetKey(_TRACK_SY, 2, 1)
			self.final_blink:SetKey(_TRACK_SX, 2.5, 1.3)
			self.final_blink:SetKey(_TRACK_SY, 2.5, 1.3)
			self.final_blink:SetKey(_TRACK_SX, 3, 1)
			self.final_blink:SetKey(_TRACK_SY, 3, 1)
			self.final_blink:Play()
	end
	self.timer:Add(function()
							Object('Plate_6'):SetZ(205)
							Object('Plate_12'):SetZ(205)
							Object('Bg_Bloor'):ChangeOpacity(0, 1, 2*self.TimeOpacity)
							blink_not_similar_items('Item_6')
							blink_not_similar_items('Item_12')							
					end,
					1)
	self.timer:Add(function()
							-- table move down
							Object('Table'):Move(0, 415, 2)
							self.sound_appear_list:PlaySound(false)
							self.timer:Add(function()
													local text = GetString('BBT_09_FINAL_MESSAGE')

													tf = CreateTextEntity(NEWSPAPER_FONT, '')
													--tf:SetXY(518, 354)
													tf:SetXY(-7+232, 0+204-125)
													tf:SetZ(192)
													tf:SetScale(1.3)
													tf:AttachTo(Object('Table'))
													tf:SetTracking(-1)
													tf:SetSpacing(0.6)
													tf:SetBorderSize(320, 100)
													tf:SetColor('0xFF000088')
													tf:SetTextAlignment(HGETEXT_CENTER + HGETEXT_MIDDLE)

													local count = string.len(text)
													local curIndex = 0
													local delay = 0.2

													local function outText()
														curIndex = curIndex + 1
														
														local curText = string.sub(text, 1, curIndex)
														tf:SetText(curText)
														
														if curIndex < count then
															self.timer:Add(outText, delay)
														else
															Object('area_final_click'):SetVisible(true)	
														end
													end		
													
													outText()
										end,
										2.1)
					end,
					1 + 3)
	
end

-- skip
function l_09_Blood:SkipMiniGame()
        if not self.ArrayForSaveMG.Completed then
			self.ArrayForSaveMG.Completed = true			
			self:GetPanelLuaObject():SetMode(EPanelMode.PM_QUEST)	
			self:IgnoreObjectMG(true)
			
			self.ArrayForSaveMG.EmptyPlaces = {4, 11}
			self.ArrayForSaveMG.PlaceItem = { 6, 1, 5, 0, 2, 4, 3,    7, 8, 9, 0, 12, 11, 10 } -- index - place, value - item  										
			self.ArrayForSaveMG.ItemPlace = { 2, 5, 7, 6, 3, 1,   8, 9, 12, 14, 13, 10 } -- index - item, value - place
			
			for i = 1, 	self.CountObjects do
				Object('Plate_'..i):ChangeOpacity(1, 0, self.TimeOpacity)
			end
			self.timer:Add(function()
								for i = 1, 	self.CountObjects do
									Object('Plate_'..i):SetXY(self.PlacesPos[self.ArrayForSaveMG.ItemPlace[i]][1], self.PlacesPos[self.ArrayForSaveMG.ItemPlace[i]][2])
									Object('Plate_'..i):ChangeOpacity(0, 1, self.TimeOpacity)
								end
							end,
							self.TimeOpacity + 0.1)
			self.timer:Add(function()		
								self:SetLightOff(false)
								self:ShowFinalList()
							end,
							2*(self.TimeOpacity + 0.1))
				
			Helpers.SaveObjectToGameState(self.Save_state_mg, self.ArrayForSaveMG)
				
        end
end

--------------------------------------------- base functions

function l_09_Blood:OnUpdate(dt)
end

function l_09_Blood:OnObjectMouseEnter(object)
end

function l_09_Blood:OnObjectMouseLeave(object)
end

function l_09_Blood:OnScreenObjectMouseDown(object, key)

	if key == HGEK_LBUTTON then
            if string.find(object:GetName(), 'Plate_') then
				self:IgnoreObjectMG(true)
				local num = tonumber(string.sub(object:GetName(), 7))
				-- определяем номер круга
				local num_circle = math.floor(num/7) + 1
				--  меняем месторасположение итема в переменных и двигаем итем на новое место
				self.ArrayForSaveMG.PlaceItem[self.ArrayForSaveMG.EmptyPlaces[num_circle]] = self.ArrayForSaveMG.ItemPlace[num]
				self.ArrayForSaveMG.PlaceItem[self.ArrayForSaveMG.ItemPlace[num]] = 0
				self.ArrayForSaveMG.ItemPlace[num], self.ArrayForSaveMG.EmptyPlaces[num_circle] = self.ArrayForSaveMG.EmptyPlaces[num_circle], self.ArrayForSaveMG.ItemPlace[num]
				Object('Plate_'..num):MoveTo(self.PlacesPos[self.ArrayForSaveMG.ItemPlace[num]][1], self.PlacesPos[self.ArrayForSaveMG.ItemPlace[num]][2], self.TimeMove)
				self.sound_move_items:StopSound()
				self.sound_move_items:PlaySound(false)
				-- light off
				self:SetLightOff(true)
				-- completed
				local compl = true
				for i = 1, 5 do
					if self.RightItemPlace[i][2] ~= self.ArrayForSaveMG.ItemPlace[self.RightItemPlace[i][1]] or 
						self.RightItemPlace[i+5][2] ~= self.ArrayForSaveMG.ItemPlace[self.RightItemPlace[i+5][1]] then
						compl = false
					end
				end
				if compl then
					self.ArrayForSaveMG.Completed = true
					self:GetPanelLuaObject():SetMode(EPanelMode.PM_QUEST)
					self.ArrayForSaveMG.EmptyPlaces = {4, 11}
					self.ArrayForSaveMG.PlaceItem[1] = 6										
					self.ArrayForSaveMG.PlaceItem[4] = 0										
					self.ArrayForSaveMG.ItemPlace[6] = 1
					self.ArrayForSaveMG.PlaceItem[10] = 12										
					self.ArrayForSaveMG.PlaceItem[11] = 0										
					self.ArrayForSaveMG.ItemPlace[12] = 10
					self.timer:Add(function()
										self:ShowFinalList()
									end,
									self.TimeMove)
				end
				
				Helpers.SaveObjectToGameState(self.Save_state_mg, self.ArrayForSaveMG)
						
				self.timer:Add(function()
									-- light on
									self:SetLightOff(false)
									if not self.ArrayForSaveMG.Completed then
										self:IgnoreObjectMG(false)
									end
								end,
								self.TimeMove)
			end
	end

end

function l_09_Blood:OnMouseMove(previous_pos, current_pos)
end

function l_09_Blood:OnObjectMouseUp(object)
end

function l_09_Blood:OnButtonPress(title)
end

--------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function l_09_Blood:LoadData(screen)
	local anim
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Background.jpg',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Background',anim,512,384,100,0,1,1)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_4.png',0,0,73,63,12,6)
	anim:SetHotSpot(36,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_1',anim,330,198,121,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_2.png',0,0,65,63,12,6)
	anim:SetHotSpot(32,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_2',anim,398,309,122,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_10.png',0,0,57,62,12,6)
	anim:SetHotSpot(28,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_3',anim,327,424,123,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_11.png',0,0,59,64,12,6)
	anim:SetHotSpot(29,32)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_4',anim,199,422,124,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_3.png',0,0,66,72,12,6)
	anim:SetHotSpot(33,36)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_5',anim,134,313,125,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_5.png',0,0,67,68,12,6)
	anim:SetHotSpot(33,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_6',anim,194,196,131,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_8.png',0,0,62,67,12,6)
	anim:SetHotSpot(31,33)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_7',anim,696,195,126,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_7.png',0,0,58,64,12,6)
	anim:SetHotSpot(29,32)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_8',anim,828,198,127,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_9.png',0,0,74,68,12,6)
	anim:SetHotSpot(37,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_9',anim,897,311,128,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_1.png',0,0,69,60,12,6)
	anim:SetHotSpot(34,30)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_10',anim,829,424,129,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_6.png',0,0,67,63,12,6)
	anim:SetHotSpot(33,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_11',anim,695,424,130,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Animations/Item_12.png',0,0,65,63,12,6)
	anim:SetHotSpot(32,31)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Item_12',anim,631,308,132,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_1',anim,329,197,101,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_2',anim,396,310,102,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_3',anim,329,424,103,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_4',anim,199,424,104,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_5',anim,132,310,105,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_6',anim,197,196,111,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_7',anim,695,197,106,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_8',anim,827,197,107,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_9',anim,893,311,108,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_10',anim,827,424,109,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_11',anim,694,424,110,0,1,1)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Plate.png',0,0,146,146,1,0)
	anim:SetHotSpot(68,71)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Plate_12',anim,629,310,112,0,0.9,0.9)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_1',anim,197,196,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_2',anim,329,197,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_3',anim,132,310,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_4',anim,264,309,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_5',anim,396,310,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_6',anim,199,424,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_7',anim,329,424,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_8',anim,695,197,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_9',anim,827,197,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_10',anim,629,310,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_11',anim,762,311,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_12',anim,893,311,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_13',anim,694,424,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x00FFFFFF')
	screen:CreateObject('area_place_14',anim,827,424,150,0,1,1)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Light_yellow.png',0,0,280,96,1,0)
	anim:SetHotSpot(140,48)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Light_1',anim,512,88,107,0,1,1)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Light_red.png',0,0,410,278,1,0)
	anim:SetHotSpot(205,139)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Light_2',anim,682,159,106,0,1,1)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Light_green.png',0,0,640,380,1,0)
	anim:SetHotSpot(320,190)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Light_3',anim,699,470,104,0,1,1)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Light_blue.png',0,0,832,216,1,0)
	anim:SetHotSpot(416,108)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Light_4',anim,526,585,103,0,1,1)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Light_orange.png',0,0,650,372,1,0)
	anim:SetHotSpot(325,186)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Light_5',anim,326,494,105,0,1,1)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Table_2.png',0,0,532,70,1,0)
	anim:SetHotSpot(266,35)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Table_2',anim,512,2,269,0,1,1)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Table.png',0,0,532,500,1,0)
	anim:SetHotSpot(34,46)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Table',anim,280,15,270,0,1,1)
	
	anim = CreateAnimation('data/Texture/Common/area.png',0,0,8,8,1,0)
	anim:SetHotSpot(4,4)
	anim:SetBlendMode(2)
	anim:SetColor('0x01FFFFFF')
	screen:CreateObject('area_final_click',anim,512,221,280,0,60,60)
	
	anim = CreateAnimation('data/Texture/Minigames/09_Blood/Bg_Bloor.jpg',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Bg_Bloor',anim,512,384,200,0,1,1)
	
end
-- CLEAR_ON_SAVE_END
