share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit02.lua
branchspacecampaign
changeset 9544 e247251fa751
parent 9542 d1ea2d1540f2
child 9546 f7530a7e5612
equal deleted inserted replaced
9542:d1ea2d1540f2 9544:e247251fa751
   193 
   193 
   194 function onNewTurn()
   194 function onNewTurn()
   195 	if not inBattle and CurrentHedgehog == green1.gear then
   195 	if not inBattle and CurrentHedgehog == green1.gear then
   196 		TurnTimeLeft = 0
   196 		TurnTimeLeft = 0
   197 	elseif CurrentHedgehog == green2.gear or CurrentHedgehog == green3.gear then
   197 	elseif CurrentHedgehog == green2.gear or CurrentHedgehog == green3.gear then
   198 			TurnTimeLeft = 0
   198 		TurnTimeLeft = 0
   199 	elseif inBattle then
   199 	elseif inBattle then
   200 		if CurrentHedgehog == green1.gear and previousHog ~= hero.gear then
   200 		if CurrentHedgehog == green1.gear and previousHog ~= hero.gear then
   201 			TurnTimeLeft = 0
   201 			TurnTimeLeft = 0
   202 			return
   202 			return
   203 		end
   203 		end
   425 		SetWind(-40)
   425 		SetWind(-40)
   426 	else
   426 	else
   427 		SetWind(math.random(-100,100))
   427 		SetWind(math.random(-100,100))
   428 	end
   428 	end
   429 end
   429 end
       
   430 
       
   431 function saveHogsPositions()
       
   432 	local positions = ""
       
   433 	positions = GetX(hero.gear)..","..GetY(hero.gear)
       
   434 	if GetHealth(green2.gear) then
       
   435 		positions = positions..","..GetX(green2.gear)..","..GetY(green2.gear)
       
   436 	end
       
   437 	if GetHealth(green3.gear) then
       
   438 		positions = positions..","..GetX(green3.gear)..","..GetY(green3.gear)
       
   439 	end
       
   440 	SaveCampaignVar("HogsPosition", positions)
       
   441 end
       
   442 
       
   443 function loadHogsPositions()
       
   444 	local positions;
       
   445 	if GetCampaignVar("HogsPosition") then
       
   446 		positions = GetCampaignVar("HogsPosition")
       
   447 	else
       
   448 		return
       
   449 	end
       
   450 	positions = split(positions,",")
       
   451 	if positions[1] then
       
   452 		hero.x = positions[1]
       
   453 		hero.y = positions[2]
       
   454 	end
       
   455 	if positions[3] then
       
   456 		green2.x = positions[3]
       
   457 		green2.y = positions[4]
       
   458 	end
       
   459 	if positions[5] then
       
   460 		green3.x = positions[5]
       
   461 		green3.y = positions[6]
       
   462 	end
       
   463 end