Infra_

Untitled

May 3rd, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. function easeGameSpeed(value)
  2.     local count = 1
  3.     local currentSpeed = math.round(getGameSpeed(), 1, "floor")
  4.  
  5.     local steps = 0.1
  6.     if not (value > currentSpeed) then
  7.         steps = -0.1
  8.     end
  9.  
  10.     for i = currentSpeed, value, steps do
  11.         setTimer(setGameSpeed, 150 * count, 1, i)
  12.         count = count + 1
  13.     end
  14. end
  15.  
  16. function math.round(number, decimals, method)
  17.     decimals = decimals or 0
  18.     local factor = 10 ^ decimals
  19.     if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
  20.     else return tonumber(("%."..decimals.."f"):format(number)) end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment