share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua
branchspacecampaign
changeset 9576 8d8bad7d78de
parent 9574 da3d39667881
child 9582 bf314b2258b3
equal deleted inserted replaced
9574:da3d39667881 9576:8d8bad7d78de
    13 local currentWaypoint = 1
    13 local currentWaypoint = 1
    14 local radius = 75
    14 local radius = 75
    15 local totalTime = 15000
    15 local totalTime = 15000
    16 local totalSaucers = 3
    16 local totalSaucers = 3
    17 local gameEnded = false
    17 local gameEnded = false
       
    18 local RED = 0xff0000ff
       
    19 local GREEN = 0x38d61cff
       
    20 local challengeObjectives = loc("To win the game you have to pass into the rings in time")..
       
    21 	"|"..loc("You'll get extra time in case you need it when you pass a ring").."|"..
       
    22 	loc("Every 2 rings, the ring color will be green and you'll get an extra flying saucer").."|"..
       
    23 	loc("Use space button twice to change flying saucer while being on air")
    18 -- dialogs
    24 -- dialogs
    19 local dialog01 = {}
    25 local dialog01 = {}
    20 -- mission objectives
    26 -- mission objectives
    21 local goals = {
    27 local goals = {
    22 	[dialog01] = {missionName, loc("Getting ready"), loc("Use your saucer and pass from the rings!"), 1, 4500},
    28 	[dialog01] = {missionName, loc("Getting ready"), challengeObjectives, 1, 4500},
    23 }
    29 }
    24 -- hogs
    30 -- hogs
    25 local hero = {}
    31 local hero = {}
    26 local ally = {}
    32 local ally = {}
    27 -- teams
    33 -- teams
    87 end
    93 end
    88 
    94 
    89 function onGameStart()
    95 function onGameStart()
    90 	AnimWait(hero.gear, 3000)
    96 	AnimWait(hero.gear, 3000)
    91 	FollowGear(hero.gear)
    97 	FollowGear(hero.gear)
       
    98 	ShowMission(missionName, loc("Challenge Objectives"), challengeObjectives, -amSkip, 0)
    92 	
    99 	
    93 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   100 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
    94 	
   101 	
    95 	AddAmmo(hero.gear, amJetpack, 3)
   102 	AddAmmo(hero.gear, amJetpack, 3)
    96 	
   103 	
   173 
   180 
   174 function AnimationSetup()
   181 function AnimationSetup()
   175 	-- DIALOG 01 - Start, some story telling
   182 	-- DIALOG 01 - Start, some story telling
   176 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   183 	AddSkipFunction(dialog01, Skipanim, {dialog01})
   177 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   184 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}})
   178 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the ice planet flying saucer stadium..."), 5000}})
   185 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("In the Ice Planet flying saucer stadium..."), 5000}})
   179 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("This is the olympic stadium of saucer flying..."), SAY_SAY, 4000}})
   186 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("This is the olympic stadium of saucer flying..."), SAY_SAY, 4000}})
   180 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("All the saucer pilots dream one day to come here and compete with the best!"), SAY_SAY, 5000}})
   187 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("All the saucer pilots dream one day to come here and compete with the best!"), SAY_SAY, 5000}})
   181 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Now you have the chance to try and get the place that you deserve between the best..."), SAY_SAY, 6000}})
   188 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("Now you have the chance to try and get the place that you deserve between the best..."), SAY_SAY, 6000}})
   182 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Use the saucer and pass from the rings..."), 5000}})
   189 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Use the saucer and pass from the rings..."), 5000}})
       
   190 	table.insert(dialog01, {func = AnimCaption, args = {hero.gear, loc("Pause the game by pressing \"P\" for more details"), 5000}})
   183 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("... can you do it?"), SAY_SAY, 2000}})
   191 	table.insert(dialog01, {func = AnimSay, args = {ally.gear, loc("... can you do it?"), SAY_SAY, 2000}})
   184 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   192 	table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}})
   185 	table.insert(dialog01, {func = startFlying, args = {hero.gear}})	
   193 	table.insert(dialog01, {func = startFlying, args = {hero.gear}})	
   186 end
   194 end
   187 
   195 
   199 		DeleteVisualGear(wp.gear)
   207 		DeleteVisualGear(wp.gear)
   200 	end
   208 	end
   201 	if currentWaypoint < 16 then
   209 	if currentWaypoint < 16 then
   202 		local wp = waypoints[currentWaypoint]
   210 		local wp = waypoints[currentWaypoint]
   203 		wp.gear = AddVisualGear(1,1,vgtCircle,1,true)
   211 		wp.gear = AddVisualGear(1,1,vgtCircle,1,true)
   204 		SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, 0xff0000ff)
       
   205 		-- add bonus time and "fuel"
   212 		-- add bonus time and "fuel"
   206 		if currentWaypoint % 2 == 0 then
   213 		if currentWaypoint % 2 == 0 then
       
   214 			PlaySound(sndBump) -- what's the crate sound?
       
   215 			SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, RED)
   207 			AddAmmo(hero.gear, amJetpack, GetAmmoCount(hero.gear, amJetpack)+1)
   216 			AddAmmo(hero.gear, amJetpack, GetAmmoCount(hero.gear, amJetpack)+1)
   208 			totalSaucers = totalSaucers + 1
   217 			totalSaucers = totalSaucers + 1
       
   218 			local message = loc("Got 1 more saucer")
   209 			if TurnTimeLeft <= 22000 then
   219 			if TurnTimeLeft <= 22000 then
   210 				TurnTimeLeft = TurnTimeLeft + 8000
   220 				TurnTimeLeft = TurnTimeLeft + 8000
   211 				totalTime = totalTime + 8000
   221 				totalTime = totalTime + 8000
   212 			end		
   222 				message = message..loc(" and 8 more seconds added to the clock")
       
   223 			end
       
   224 			AnimCaption(hero.gear, message, 4000)
   213 		else
   225 		else
       
   226 			SetVisualGearValues(wp.gear, wp.x,wp.y, 20, 200, 0, 0, 100, radius, 3, GREEN)
   214 			if TurnTimeLeft <= 16000 then
   227 			if TurnTimeLeft <= 16000 then
   215 				TurnTimeLeft = TurnTimeLeft + 6000
   228 				TurnTimeLeft = TurnTimeLeft + 6000
   216 				totalTime = totalTime + 6000
   229 				totalTime = totalTime + 6000
       
   230 				if currentWaypoint ~= 1 then
       
   231 					AnimCaption(hero.gear, loc("6 more seconds added to the clock"), 4000)
       
   232 				end
   217 			end
   233 			end
   218 		end	
   234 		end	
   219 		radius = radius - 4
   235 		radius = radius - 4
   220 		currentWaypoint = currentWaypoint + 1
   236 		currentWaypoint = currentWaypoint + 1
   221 		return true
   237 		return true
       
   238 	else
       
   239 		AnimCaption(hero.gear, loc("Congratulations, you won!"), 4000)
   222 	end
   240 	end
   223 	return false
   241 	return false
   224 end
   242 end
   225 
   243 
   226 function checkIfHeroInWaypoint()
   244 function checkIfHeroInWaypoint()