share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/cosmos.lua
changeset 12088 1da37e2ba6fd
parent 12049 030464f34d47
child 12223 f30eab4b9b05
equal deleted inserted replaced
12087:78e9fbd52ffc 12088:1da37e2ba6fd
   115 	AnimSetGearPosition(guard2.gear, guard2.x, guard2.y)
   115 	AnimSetGearPosition(guard2.gear, guard2.x, guard2.y)
   116 	-- get the check point
   116 	-- get the check point
   117 	if tonumber(GetCampaignVar("CosmosCheckPoint")) then
   117 	if tonumber(GetCampaignVar("CosmosCheckPoint")) then
   118 		checkPointReached = tonumber(GetCampaignVar("CosmosCheckPoint"))
   118 		checkPointReached = tonumber(GetCampaignVar("CosmosCheckPoint"))
   119 	end
   119 	end
       
   120 	-- Whether to start with an animation
       
   121 	local startSequence
   120 	-- do checkpoint stuff needed before game starts
   122 	-- do checkpoint stuff needed before game starts
   121 	if checkPointReached == 1 then
   123 	if checkPointReached == 1 then
   122 		-- Start of the game
   124 		-- Start of the game
       
   125 		startSequence = true
   123 	elseif checkPointReached == 2 then
   126 	elseif checkPointReached == 2 then
   124 		-- Hero on the column, just took space ship unnoticed
   127 		-- Hero on the column, just took space ship unnoticed
       
   128 		startSequence = true
   125 		AnimSetGearPosition(hero.gear, saucerX, saucerY)
   129 		AnimSetGearPosition(hero.gear, saucerX, saucerY)
   126 	elseif checkPointReached == 3 then
   130 	elseif checkPointReached == 3 then
   127 		-- Hero near column, without space ship unnoticed
   131 		-- Hero near column, without space ship unnoticed
       
   132 		startSequence = true
   128 	elseif checkPointReached == 4 then
   133 	elseif checkPointReached == 4 then
   129 		-- Hero visited moon for fuels
   134 		-- Hero visited moon for fuels
       
   135 		startSequence = true
   130 		AnimSetGearPosition(hero.gear, 1110, 850)
   136 		AnimSetGearPosition(hero.gear, 1110, 850)
   131 	elseif checkPointReached == 5 then
   137 	elseif checkPointReached == 5 then
       
   138 		startSequence = false
   132 		-- Hero has visited a planet, he has plenty of fuels and can change planet
   139 		-- Hero has visited a planet, he has plenty of fuels and can change planet
   133 		if GetCampaignVar("Planet") == "moon" then
   140 		if GetCampaignVar("Planet") == "moon" then
   134 			AnimSetGearPosition(hero.gear, 1110, 850)
   141 			AnimSetGearPosition(hero.gear, 1110, 850)
   135 		elseif GetCampaignVar("Planet") == "desertPlanet" then
   142 		elseif GetCampaignVar("Planet") == "desertPlanet" then
   136 			AnimSetGearPosition(hero.gear, 3670, 270)
   143 			AnimSetGearPosition(hero.gear, 3670, 270)
   142 			AnimSetGearPosition(hero.gear, 620, 530)
   149 			AnimSetGearPosition(hero.gear, 620, 530)
   143 		elseif GetCampaignVar("Planet") == "meteorite" then
   150 		elseif GetCampaignVar("Planet") == "meteorite" then
   144 			AnimSetGearPosition(hero.gear, 3080, 850)
   151 			AnimSetGearPosition(hero.gear, 3080, 850)
   145 		end
   152 		end
   146 	end
   153 	end
   147 
   154 	AnimInit(startSequence)
   148 	AnimInit()
       
   149 	AnimationSetup()
   155 	AnimationSetup()
   150 end
   156 end
   151 
   157 
   152 function onGameStart()
   158 function onGameStart()
   153 	-- wait for the first turn to start
   159 	-- wait for the first turn to start