share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/enemy.lua
changeset 15029 09c63d4bcf53
parent 15019 51fbc0034c6f
child 15072 4c40266fae97
equal deleted inserted replaced
15028:20c80919d97d 15029:09c63d4bcf53
   102 
   102 
   103 startAnim = {}
   103 startAnim = {}
   104 finalAnim = {}
   104 finalAnim = {}
   105 -----------------------------Animations--------------------------------
   105 -----------------------------Animations--------------------------------
   106 function CondNeedToTurn(hog1, hog2)
   106 function CondNeedToTurn(hog1, hog2)
   107   xl, xd = GetX(hog1), GetX(hog2)
   107   if (not GetHealth(hog1)) or (not GetHealth(hog2)) then
       
   108     return
       
   109   end
       
   110   local xl, xd = GetX(hog1), GetX(hog2)
   108   if xl > xd then
   111   if xl > xd then
   109     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}})
   112     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Left"}})
   110     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}})
   113     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Right"}})
   111   elseif xl < xd then
   114   elseif xl < xd then
   112     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}})
   115     AnimInsertStepNext({func = AnimTurn, args = {hog2, "Left"}})
   113     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Right"}})
   116     AnimInsertStepNext({func = AnimTurn, args = {hog1, "Right"}})
   114   end
   117   end
   115 end
   118 end
   116 
   119 
   117 function CondNeedToTurn2(hog1, hog2)
   120 function CondNeedToTurn2(hog1, hog2)
   118   xl, xd = GetX(hog1), GetX(hog2)
   121   if (not GetHealth(hog1)) or (not GetHealth(hog2)) then
       
   122     return
       
   123   end
       
   124   local xl, xd = GetX(hog1), GetX(hog2)
   119   if xl > xd then
   125   if xl > xd then
   120     AnimTurn(hog1, "Left")
   126     AnimTurn(hog1, "Left")
   121     AnimTurn(hog2, "Right")
   127     AnimTurn(hog2, "Right")
   122   elseif xl < xd then
   128   elseif xl < xd then
   123     AnimTurn(hog2, "Left")
   129     AnimTurn(hog2, "Left")