# HG changeset patch # User Wuzzy # Date 1518296528 -3600 # Node ID b543d767fed34177d1b6dc4aab44f92e25e6b3e8 # Parent 21eda4fe383c29b1f41987728f0cce0737f19583 Make first waypoint flash TechRacer, before hog starts racing diff -r 21eda4fe383c -r b543d767fed3 share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua --- a/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua Sat Feb 10 21:28:22 2018 +0100 +++ b/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua Sat Feb 10 22:02:08 2018 +0100 @@ -305,6 +305,22 @@ -- RACER METHODS ----------------- +-- Returns min opacity, max opacity and flashing speed (`FrameTicks`) +-- for the waypoint visual gears +function FlashingHelper(wpIndex) + local minO, maxO, flashing + if wpIndex == 0 then + -- Notable flashing of first waypoint + minO, maxO = 92, 255 + flashing = 2 + else + -- Slow pulsation + minO, maxO = 164, 224 + flashing = 10 + end + return minO, maxO, flashing +end + function CheckWaypoints() trackFinished = true @@ -672,7 +688,9 @@ wpCol[wpCount] = 0xffffffff wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true) - SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 164, 224, 1, 10, 0, wpRad, 5, wpCol[wpCount]) + local minO, maxO, flashing = FlashingHelper(wpCount) + -- Make first waypoint flash very noticably before the hog starts racing + SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], minO, maxO, 1, flashing, 0, wpRad, 5, wpCol[wpCount]) wpCount = wpCount + 1 @@ -1056,7 +1074,8 @@ for i = 0,(wpCount-1) do wpActive[i] = false wpCol[i] = 0xffffffff - SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 164, 224, 1, 10, 0, wpRad, 5, wpCol[i]) + local minO, maxO, flashing = FlashingHelper(i) + SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], minO, maxO, 1, flashing, 0, wpRad, 5, wpCol[i]) end end