Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. username = "Finalnova"
  2.  
  3. for i=0,200 do
  4. tfm.exec.bindKeyboard(username,i,true,true)
  5. end
  6.  
  7. system.bindMouse(username,true)
  8.  
  9. function randomId()
  10.  
  11. local idHolder = {0,1,9}
  12. return idHolder[math.random(0,#idHolder)]
  13.  
  14. end
  15.  
  16. function eventMouse(n,x,y)
  17.  
  18. local p = tfm.get.room.playerList[n]
  19. drawLightining(p.x,p.y,x,y,randomId())
  20. drawLightining(p.x,p.y,x,y,randomId())
  21. drawLightining(p.x,p.y,x,y,randomId())
  22. tfm.exec.movePlayer(n,x,y)
  23.  
  24. end
  25.  
  26. function eventKeyboard(n,k,d,x,y)
  27.  
  28. local p = tfm.get.room.playerList[n]
  29. p.x = x
  30. p.y = y
  31.  
  32. end
  33.  
  34. move = 3
  35. ms = move/20
  36. ma = ms/1200
  37.  
  38. function drawLine(x1,y1,x2,y2,spaces,id)
  39.  
  40. id = id or 9
  41. spaces = spaces or 3
  42.  
  43.  
  44. local distance = getDistance(x1,y1,x2,y2)
  45. local numOfParticles = math.floor(distance/spaces)
  46. local angle = getAngle(x1,y1,x2,y2)
  47. for i=0,numOfParticles do
  48.  
  49. local dotX = x1+math.cos(angle)*(i*spaces)
  50. local dotY = y1+math.sin(angle)*(i*spaces)
  51. tfm.exec.displayParticle(id,dotX,dotY,math.random()*ms-ms/2,math.random()*ms-ms/2,math.random()*ma-ma/2,math.random()*ma-ma/2)
  52.  
  53. end
  54.  
  55. end
  56.  
  57. function getDistance(x1,y1,x2,y2)
  58.  
  59. return math.sqrt(math.abs(x1-x2)^2+math.abs(y1-y2)^2)
  60.  
  61. end
  62.  
  63. function getAngle(x1,y1,x2,y2)
  64.  
  65. return math.atan2(y2-y1,x2-x1)
  66.  
  67. end
  68.  
  69. function radToDeg(i)
  70.  
  71. i = i*180/math.pi
  72. i = i<0 and i+360 or i
  73. return i
  74.  
  75. end
  76.  
  77. function degToRad(i)
  78.  
  79. return i*math.pi/180
  80.  
  81. end
  82.  
  83.  
  84. function drawLightining(x1,y1,x2,y2,id)
  85.  
  86. local ang = getAngle(x1,y1,x2,y2)
  87. local dis = getDistance(x1,y1,x2,y2)
  88. local rd = function() return math.random()*25+25 end
  89. local ra = function() return math.pi/(math.random()*120+30) end
  90. local wave = {}
  91. local addWave = function(k,xx,yy) wave[k] = {x=xx,y=yy} end
  92.  
  93. --------------------------------------
  94.  
  95. addWave(0,x1,y1)
  96. local td = 0
  97. local randomDistance = rd()
  98. local randomAngle = ra()*((dis-td)/100)
  99. local zigZag = math.random()<0.5 and 1 or -1
  100. local ca = ang + randomAngle*zigZag
  101.  
  102.  
  103. while randomDistance<dis-td do
  104.  
  105. td = td + randomDistance
  106.  
  107. local tx = x1+math.cos(ca)*td
  108. local ty = y1+math.sin(ca)*td
  109.  
  110. addWave(#wave+1,tx,ty)
  111.  
  112. randomDistance = rd()
  113. randomAngle = ra()*((dis-td)/100)
  114. zigZag = zigZag * -1
  115. ca = ang + randomAngle*zigZag
  116.  
  117. end
  118.  
  119. addWave(#wave+1,x2,y2)
  120.  
  121. for i=0,#wave-1 do
  122.  
  123. local cw = wave
  124. local nw = wave[i+1]
  125. drawLine(cw.x,cw.y,nw.x,nw.y,3,id)
  126.  
  127. end
  128.  
  129.  
  130. end
  131. tfm.exec.newGame(0)
  132. tfm.exec.disableAutoNewGame(true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement