share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice01.lua
changeset 9734 da2cb993fd61
parent 9642 8a691e0f117a
child 9757 9be28be004d4
equal deleted inserted replaced
9733:37f84780eb14 9734:da2cb993fd61
   191 	end
   191 	end
   192 	
   192 	
   193 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   193 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
   194 	AddEvent(onHeroFinalStep, {hero.gear}, heroFinalStep, {hero.gear}, 0)
   194 	AddEvent(onHeroFinalStep, {hero.gear}, heroFinalStep, {hero.gear}, 0)
   195 	AddEvent(onAntiFlyArea, {hero.gear}, antiFlyArea, {hero.gear}, 1)
   195 	AddEvent(onAntiFlyArea, {hero.gear}, antiFlyArea, {hero.gear}, 1)
       
   196 	AddEvent(onAntiFlyAreaVelocity, {hero.gear}, antiFlyAreaVelocity, {hero.gear}, 1)
   196 	AddEvent(onNonAntiFlyArea, {hero.gear}, nonAntiFlyArea, {hero.gear}, 1)
   197 	AddEvent(onNonAntiFlyArea, {hero.gear}, nonAntiFlyArea, {hero.gear}, 1)
   197 	AddEvent(onThantaDeath, {bandit1.gear}, thantaDeath, {bandit1.gear}, 0)
   198 	AddEvent(onThantaDeath, {bandit1.gear}, thantaDeath, {bandit1.gear}, 0)
   198 	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
   199 	AddEvent(onHeroWin, {hero.gear}, heroWin, {hero.gear}, 0)
   199 	
   200 	
   200 	AddAmmo(hero.gear, amJetpack, 99)
   201 	AddAmmo(hero.gear, amJetpack, 99)
   339 		return true
   340 		return true
   340 	end
   341 	end
   341 	return false
   342 	return false
   342 end
   343 end
   343 
   344 
       
   345 function onAntiFlyAreaVelocity(gear)
       
   346 	if not hero.dead and GetY(gear) < 1300 then
       
   347 		return true
       
   348 	end
       
   349 	return false
       
   350 end
       
   351 
   344 function onNonAntiFlyArea(gear)
   352 function onNonAntiFlyArea(gear)
   345 	if not hero.dead and (GetX(gear) < 860 and GetY(gear) > 1400) and heroAtAntiFlyArea then
   353 	if not hero.dead and (GetX(gear) < 860 and GetY(gear) > 1400) and heroAtAntiFlyArea then
   346 		return true
   354 		return true
   347 	end
   355 	end
   348 	return false
   356 	return false
   393 
   401 
   394 -------------- ACTIONS ------------------
   402 -------------- ACTIONS ------------------
   395 
   403 
   396 function antiFlyArea(gear)
   404 function antiFlyArea(gear)
   397 	heroAtAntiFlyArea = true
   405 	heroAtAntiFlyArea = true
   398 	if TurnTimeLeft < -1 then
   406 	if not heroVisitedAntiFlyArea then
   399 		heroVisitedAntiFlyArea = true
   407 		TurnTimeLeft = 0        
   400 		TurnTimeLeft = 0	
       
   401 		FollowGear(hero.gear)
   408 		FollowGear(hero.gear)
   402 		AddAmmo(hero.gear, amJetpack, 0)
   409 		AnimSwitchHog(bandit1.gear)     
   403 		AnimSwitchHog(bandit1.gear)	
       
   404 		FollowGear(hero.gear)
   410 		FollowGear(hero.gear)
   405 		TurnTimeLeft = 0
   411 		TurnTimeLeft = 0
   406 	else
   412 	end	
   407 		AddAmmo(hero.gear, amJetpack, 0)	
   413 	AddAmmo(hero.gear, amJetpack, 0)
   408 	end
   414 	heroVisitedAntiFlyArea = true
       
   415 end
       
   416 
       
   417 function antiFlyAreaVelocity(gear)
       
   418 	SetGearVelocity(hero.gear, 0, 0)
   409 end
   419 end
   410 
   420 
   411 function nonAntiFlyArea(gear)
   421 function nonAntiFlyArea(gear)
   412 	heroAtAntiFlyArea = false
   422 	heroAtAntiFlyArea = false
   413 	AddAmmo(hero.gear, amJetpack, 99)
   423 	AddAmmo(hero.gear, amJetpack, 99)
   466 	if goals[anim] ~= nil then
   476 	if goals[anim] ~= nil then
   467 		ShowMission(unpack(goals[anim]))
   477 		ShowMission(unpack(goals[anim]))
   468     end
   478     end
   469     if anim == dialog02 then
   479     if anim == dialog02 then
   470 		actionsOnWin()
   480 		actionsOnWin()
       
   481 	else
       
   482 		AnimSwitchHog(hero.gear)
   471 	end
   483 	end
   472 end
   484 end
   473 
   485 
   474 function AnimationSetup()
   486 function AnimationSetup()
   475 	-- DIALOG 01 - Start, welcome to moon
   487 	-- DIALOG 01 - Start, welcome to moon