share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua
changeset 14612 bd15c8551318
parent 14578 50f511588635
child 14898 4596357d002d
equal deleted inserted replaced
14611:3cf7799e04b5 14612:bd15c8551318
    10 
    10 
    11 ----------------- VARIABLES --------------------
    11 ----------------- VARIABLES --------------------
    12 -- globals
    12 -- globals
    13 local missionName = loc("Hard flying")
    13 local missionName = loc("Hard flying")
    14 local challengeStarted = false
    14 local challengeStarted = false
       
    15 local challengeStartRequested = false
    15 local currentWaypoint = 1
    16 local currentWaypoint = 1
    16 local radius = 75 -- Ring radius. Will become smaller and smaller
    17 local radius = 75 -- Ring radius. Will become smaller and smaller
    17 local totalTime = 15000 -- Total available time. Initial value is start time; is added to later when player wins extra time
    18 local totalTime = 15000 -- Total available time. Initial value is start time; is added to later when player wins extra time
    18 local totalSaucers = 3
    19 local totalSaucers = 3
    19 local gameEnded = false
    20 local gameEnded = false
    86 	hero.gear = AddMissionHog(100)
    87 	hero.gear = AddMissionHog(100)
    87 	hero.name = GetHogName(hero.gear)
    88 	hero.name = GetHogName(hero.gear)
    88 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    89 	AnimSetGearPosition(hero.gear, hero.x, hero.y)
    89 	-- Ally
    90 	-- Ally
    90 	teamB.name = AddTeam(teamB.name, teamB.color, "heart", "Island", "Default", "cm_face")
    91 	teamB.name = AddTeam(teamB.name, teamB.color, "heart", "Island", "Default", "cm_face")
       
    92 	SetTeamPassive(teamB.name, true)
    91 	ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
    93 	ally.gear = AddHog(ally.name, 0, 100, "war_airwarden02")
    92 	AnimSetGearPosition(ally.gear, ally.x, ally.y)
    94 	AnimSetGearPosition(ally.gear, ally.x, ally.y)
    93 	HogTurnLeft(ally.gear, true)
    95 	HogTurnLeft(ally.gear, true)
    94 
    96 
    95 	timeRecord = tonumber(GetCampaignVar("IceStadiumBestTime"))
    97 	timeRecord = tonumber(GetCampaignVar("IceStadiumBestTime"))
   132 		heroLost()
   134 		heroLost()
   133 	end
   135 	end
   134 end
   136 end
   135 
   137 
   136 function onNewTurn()
   138 function onNewTurn()
   137 	if not hero.dead and CurrentHedgehog == ally.gear and challengeStarted then
   139 	if challengeStartRequested then
   138 		heroLost()
   140 		challengeStarted = true
   139 	elseif not hero.dead and CurrentHedgehog == hero.gear and challengeStarted then
   141 	end
       
   142 	if not hero.dead and CurrentHedgehog == hero.gear and challengeStarted then
   140 		SetWeapon(amJetpack)
   143 		SetWeapon(amJetpack)
   141 	end
   144 	end
   142 	heroTurn = CurrentHedgehog == hero.gear
   145 	heroTurn = CurrentHedgehog == hero.gear
   143 end
   146 end
   144 
   147 
   256 end
   259 end
   257 
   260 
   258 ------------------ Other Functions -------------------
   261 ------------------ Other Functions -------------------
   259 
   262 
   260 function startFlying()
   263 function startFlying()
   261 	AnimSwitchHog(ally.gear)
   264 	challengeStartRequested = true
   262 	EndTurn(true)
   265 	EndTurn(true)
   263 	challengeStarted = true
       
   264 end
   266 end
   265 
   267 
   266 function placeNextWaypoint()
   268 function placeNextWaypoint()
   267 	if gameEnded then
   269 	if gameEnded then
   268 		return
   270 		return