share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert01.lua
changeset 9810 54c0fdec4600
parent 9802 00216d609140
child 9831 afa4e3e04cc5
equal deleted inserted replaced
9809:1e32628eb167 9810:54c0fdec4600
     8 -- Idea: game will be successfully end when the 2 lower crates are collected
     8 -- Idea: game will be successfully end when the 2 lower crates are collected
     9 -- it would be more defficult (and sadistic) if one should collect *all* the crates
     9 -- it would be more defficult (and sadistic) if one should collect *all* the crates
    10 
    10 
    11 HedgewarsScriptLoad("/Scripts/Locale.lua")
    11 HedgewarsScriptLoad("/Scripts/Locale.lua")
    12 HedgewarsScriptLoad("/Scripts/Animate.lua")
    12 HedgewarsScriptLoad("/Scripts/Animate.lua")
       
    13 HedgewarsScriptLoad("/Scripts/Utils.lua")
    13 HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
    14 HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua")
    14 
    15 
    15 ----------------- VARIABLES --------------------
    16 ----------------- VARIABLES --------------------
    16 -- globals
    17 -- globals
    17 local campaignName = loc("A Space Adventure")
    18 local campaignName = loc("A Space Adventure")
   189 	AddGear(3450, 720, gtMine, 0, 0, 0, 0)
   190 	AddGear(3450, 720, gtMine, 0, 0, 0, 0)
   190 
   191 
   191 	local x = 800
   192 	local x = 800
   192 	while x < 1630 do
   193 	while x < 1630 do
   193 		AddGear(x, 900, gtMine, 0, 0, 0, 0)
   194 		AddGear(x, 900, gtMine, 0, 0, 0, 0)
   194 		x = x + math.random(8,20)
   195 		x = x + GetRandom(13)+8
   195 	end
   196 	end
   196 	x = 1890
   197 	x = 1890
   197 	while x < 2988 do
   198 	while x < 2988 do
   198 		AddGear(x, 760, gtMine, 0, 0, 0, 0)
   199 		AddGear(x, 760, gtMine, 0, 0, 0, 0)
   199 		x = x + math.random(8,20)
   200 		x = x + GetRandom(13)+8
   200 	end
   201 	end
   201 	x = 2500
   202 	x = 2500
   202 	while x < 3300 do
   203 	while x < 3300 do
   203 		AddGear(x, 1450, gtMine, 0, 0, 0, 0)
   204 		AddGear(x, 1450, gtMine, 0, 0, 0, 0)
   204 		x = x + math.random(8,20)
   205 		x = x + GetRandom(13)+8
   205 	end
   206 	end
   206 	x = 1570
   207 	x = 1570
   207 	while x < 2900 do
   208 	while x < 2900 do
   208 		AddGear(x, 470, gtMine, 0, 0, 0, 0)
   209 		AddGear(x, 470, gtMine, 0, 0, 0, 0)
   209 		x = x + math.random(8,20)
   210 		x = x + GetRandom(13)+8
   210 	end
   211 	end
   211 
   212 
   212 	if checkPointReached == 1 then
   213 	if checkPointReached == 1 then
   213 		AddEvent(onHeroFleeFirstBattle, {hero.gear}, heroFleeFirstBattle, {hero.gear}, 1)
   214 		AddEvent(onHeroFleeFirstBattle, {hero.gear}, heroFleeFirstBattle, {hero.gear}, 1)
   214 		AddEvent(onHeroAtCheckpoint2, {hero.gear}, heroAtCheckpoint2, {hero.gear}, 0)
   215 		AddEvent(onHeroAtCheckpoint2, {hero.gear}, heroAtCheckpoint2, {hero.gear}, 0)
   332 	return false
   333 	return false
   333 end
   334 end
   334 
   335 
   335 function onHeroFleeFirstBattle(gear)
   336 function onHeroFleeFirstBattle(gear)
   336 	if GetHealth(hero.gear) and GetHealth(smuggler1.gear) and heroIsInBattle
   337 	if GetHealth(hero.gear) and GetHealth(smuggler1.gear) and heroIsInBattle
   337 			and distance(hero.gear, smuggler1.gear) > 1400 and StoppedGear(hero.gear) then
   338 			and not gearIsInCircle(smuggler1.gear, GetX(hero.gear), GetY(hero.gear), 1400, false)
       
   339 			and StoppedGear(hero.gear) then
   338 		return true
   340 		return true
   339 	end
   341 	end
   340 	return false
   342 	return false
   341 end
   343 end
   342 
   344