share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
changeset 12971 b543d767fed3
parent 12969 a5c5fe878a4e
child 13029 a568bc16a99a
equal deleted inserted replaced
12970:21eda4fe383c 12971:b543d767fed3
   302 
   302 
   303 
   303 
   304 -----------------
   304 -----------------
   305 -- RACER METHODS
   305 -- RACER METHODS
   306 -----------------
   306 -----------------
       
   307 
       
   308 -- Returns min opacity, max opacity and flashing speed (`FrameTicks`)
       
   309 -- for the waypoint visual gears
       
   310 function FlashingHelper(wpIndex)
       
   311         local minO, maxO, flashing
       
   312         if wpIndex == 0 then
       
   313                 -- Notable flashing of first waypoint
       
   314                 minO, maxO = 92, 255
       
   315                 flashing = 2
       
   316         else
       
   317                 -- Slow pulsation
       
   318                 minO, maxO = 164, 224
       
   319                 flashing = 10
       
   320         end
       
   321 	return minO, maxO, flashing
       
   322 end
   307 
   323 
   308 function CheckWaypoints()
   324 function CheckWaypoints()
   309 
   325 
   310         trackFinished = true
   326         trackFinished = true
   311 
   327 
   670             wpX[wpCount] = x
   686             wpX[wpCount] = x
   671             wpY[wpCount] = y
   687             wpY[wpCount] = y
   672             wpCol[wpCount] = 0xffffffff
   688             wpCol[wpCount] = 0xffffffff
   673             wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
   689             wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
   674 
   690 
   675             SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 164, 224, 1, 10, 0, wpRad, 5, wpCol[wpCount])
   691             local minO, maxO, flashing = FlashingHelper(wpCount)
       
   692             -- Make first waypoint flash very noticably before the hog starts racing
       
   693             SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], minO, maxO, 1, flashing, 0, wpRad, 5, wpCol[wpCount])
   676 
   694 
   677             wpCount = wpCount + 1
   695             wpCount = wpCount + 1
   678 
   696 
   679             --AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
   697             --AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
   680         end
   698         end
  1054         -- Set the waypoints to unactive on new round
  1072         -- Set the waypoints to unactive on new round
  1055         if not gameOver then
  1073         if not gameOver then
  1056                 for i = 0,(wpCount-1) do
  1074                 for i = 0,(wpCount-1) do
  1057                         wpActive[i] = false
  1075                         wpActive[i] = false
  1058                         wpCol[i] = 0xffffffff
  1076                         wpCol[i] = 0xffffffff
  1059                         SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 164, 224, 1, 10, 0, wpRad, 5, wpCol[i])
  1077                         local minO, maxO, flashing = FlashingHelper(i)
       
  1078                         SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], minO, maxO, 1, flashing, 0, wpRad, 5, wpCol[i])
  1060                 end
  1079                 end
  1061         end
  1080         end
  1062 
  1081 
  1063         -- Handle Starting Stage of Game
  1082         -- Handle Starting Stage of Game
  1064         if (gameOver == false) and (gameBegun == false) then
  1083         if (gameOver == false) and (gameBegun == false) then