Guest User

Arrow click

a guest
Dec 5th, 2015
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. tfm.exec.disableAutoNewGame(true)
  3. tfm.exec.disableAfkDeath(true)
  4. tfm.exec.disableAutoShaman(true)
  5.  
  6. tfm.exec.newGame("@6385854")
  7.  
  8.  
  9. function eventChatCommand(name,message)
  10. if message=="skip" then
  11. tfm.exec.setGameTime (0 , true )
  12. end
  13. if message=="respawn" then
  14. tfm.exec.respawnPlayer(name)
  15. end
  16. if message=="long" then
  17. tfm.exec.setGameTime(9999, true)
  18. end
  19. if message=="clear" then
  20. for id, object in pairs(tfm.get.room.objectList) do
  21. tfm.exec.removeObject(id)
  22. end
  23. end
  24. end
  25.  
  26.  
  27. function eventNewPlayer(name)
  28. for _, k in pairs({40, 83, 32}) do
  29. tfm.exec.bindKeyboard(name, k, true, true)
  30. end
  31. system.bindMouse(name,true)
  32. end
  33.  
  34. function eventKeyboard(player, key, down, x, y)
  35. if key==40 or key==83 then
  36. if tfm.get.room.playerList[player].isFacingRight==true then
  37. tfm.exec.addShamanObject(35, x+15, y, 0, 30, 0, false)
  38. elseif tfm.get.room.playerList[player].isFacingRight==false then
  39. tfm.exec.addShamanObject(35, x-15, y, 180, -30, 0, false)
  40. end
  41. end
  42. if key==32 then
  43. tfm.exec.movePlayer(player,0,0,true,0,-50,false)
  44. end
  45. end
  46.  
  47. function eventMouse(player,x,y)
  48. local tx=tfm.get.room.playerList[player].x
  49. local ty=tfm.get.room.playerList[player].y
  50. local tangle=(180/math.pi)*math.atan2((y-ty),(x-tx))
  51. local rx=x-tx
  52. local ry=y-ty
  53.  
  54.  
  55. print(tangle)
  56. if x>tx then
  57. tfm.exec.addShamanObject(35, tx+20, ty, tangle, 30, ry/rx*30, false)
  58. elseif x<tx then
  59. tfm.exec.addShamanObject(35, tx-20, ty, tangle, -30, ry/rx*(-30), false)
  60. elseif x==tx and y>ty then
  61. tfm.exec.addShamanObject(35, tx, ty+15, tangle, 0, 30, false)
  62. elseif x==tx and y<ty then
  63. tfm.exec.addShamanObject(35, tx, ty-15, tangle, 0, -30, false)
  64. end
  65. end
  66.  
  67. for name in pairs(tfm.get.room.playerList) do
  68. eventNewPlayer(name)
  69. end
Advertisement
Add Comment
Please, Sign In to add comment