share/hedgewars/Data/Maps/TrophyRace/map.lua
changeset 13011 c819675d4f4f
parent 13010 d92c364f004d
child 13012 d82fec121f31
equal deleted inserted replaced
13010:d92c364f004d 13011:c819675d4f4f
    95         worsttime = 99999
    95         worsttime = 99999
    96         worsthog = nil
    96         worsthog = nil
    97         lasthog = nil
    97         lasthog = nil
    98 end
    98 end
    99 
    99 
   100 function onHogAttack()
   100 function onHogAttack(ammoType)
   101     if TurnTimeLeft == 0 then
   101     if TurnTimeLeft == 0 then
   102         killHog()
   102         killHog()
       
   103     elseif ammoType == amRope then
       
   104         HideMission()
   103     end
   105     end
   104 end
   106 end
   105 
   107 
   106 function onNewTurn()
   108 function onNewTurn()
   107     if lasthog ~= nil then 
   109     if lasthog ~= nil then 
   129     elseif CurrentHedgehog ~= nil then
   131     elseif CurrentHedgehog ~= nil then
   130         x, y = GetGearPosition(CurrentHedgehog)
   132         x, y = GetGearPosition(CurrentHedgehog)
   131         if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle
   133         if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle
   132             reached = true
   134             reached = true
   133             local ttime = GameTime-startTime
   135             local ttime = GameTime-startTime
   134             --give it a sound;)
   136             -- give it a sound ;)
   135             if ttime < besttime then
   137             if ttime < besttime then
   136                 PlaySound (sndHomerun)
   138                 PlaySound (sndHomerun)
   137             else
   139             elseif ttime > worsttime then
   138                 PlaySound (sndHellish)
   140                 PlaySound (sndHellish)
   139             end
   141             end
   140             for i = 0, numhhs - 1 do
   142             for i = 0, numhhs - 1 do
   141                 if hhs[i] == CurrentHedgehog then
   143                 if hhs[i] == CurrentHedgehog then
   142                     times[numhhs] = ttime
   144                     times[numhhs] = ttime
   203     if GetGearType(gear) == gtHedgehog then
   205     if GetGearType(gear) == gtHedgehog then
   204         hhs[numhhs] = gear
   206         hhs[numhhs] = gear
   205         times[numhhs] = 0
   207         times[numhhs] = 0
   206         numhhs = numhhs + 1
   208         numhhs = numhhs + 1
   207     end
   209     end
   208 --    elseif GetGearType(gear) == gtRope then -- rope is shot
   210 end
   209 end
       
   210 
       
   211 --function onGearDelete(gear)
       
   212 --    if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope
       
   213 --        --TurnTimeLeft = 0 -- end turn or not? hm...
       
   214 --        lasthog = CurrentHedgehog
       
   215 --        
       
   216 --    end
       
   217 --end
       
   218 
   211 
   219 function onAchievementsDeclaration()
   212 function onAchievementsDeclaration()
   220     for team,time in pairs(bestTimes) do
   213     for team,time in pairs(bestTimes) do
   221         DeclareAchievement("rope race", team, "TrophyRace", time)
   214         DeclareAchievement("rope race", team, "TrophyRace", time)
   222     end
   215     end