share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon02.lua
changeset 9772 30a9e740ec09
parent 9758 3b8058b251b8
child 10289 c3a77ff02a23
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon02.lua	Tue Dec 10 00:00:08 2013 +0400
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon02.lua	Tue Dec 10 02:30:53 2013 +0200
@@ -14,7 +14,7 @@
 	loc("You have to stand very close to him")
 local currentPosition = 1
 local previousTimeLeft = 0
-local startChallenge = falses
+local startChallenge = false
 -- dialogs
 local dialog01 = {}
 local dialog02 = {}
@@ -84,7 +84,6 @@
 	AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0)
 
 	AddAmmo(hero.gear, amRope, 1)
-	AddAmmo(hero.gear, amSkip, 1)
 
 	SendHealthStatsOff()
 	hogTurn = runner.gear
@@ -92,7 +91,7 @@
 end
 
 function onNewTurn()
-	if startChallenge then
+	if startChallenge and currentPosition < 5 then
 		if CurrentHedgehog ~= hero.gear then
 			TurnTimeLeft = 0
 		else
@@ -116,7 +115,7 @@
 end
 
 function onGameTick20()
-	if isHeroNextToRunner() then
+	if GetHealth(hero.gear) and startChallenge and isHeroNextToRunner() and currentPosition < 5 then
 		moveRunner()
 	end
 end
@@ -150,6 +149,8 @@
     end
     if anim == dialog01 then
 		moveRunner()
+	elseif anim == dialog02 then
+		win()
     end
 end
 
@@ -191,13 +192,14 @@
 end
 
 function moveRunner()
-	if currentPosition > 3 then
+	if currentPosition == 4 then
+		currentPosition = currentPosition + 1
 		if GetX(hero.gear) > GetX(runner.gear) then
 			HogTurnLeft(runner.gear, false)
 		end
+		AddAnim(dialog02)
 		TurnTimeLeft = 0
-		AddAnim(dialog02)
-	else
+	elseif currentPosition < 4 then
 		if not startChallenge then
 			startChallenge = true
 		end
@@ -211,6 +213,7 @@
 			previousTimeLeft = TurnTimeLeft
 		end
 		currentPosition = currentPosition + 1
+		AddVisualGear(GetX(runner.gear), GetY(runner.gear), vgtExplosion, 0, false) 
 		SetGearPosition(runner.gear, runner.places[currentPosition].x, runner.places[currentPosition].y)
 		TurnTimeLeft = 0
 	end