Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. function eventLoop()
  2.     tfm.exec.moveObject(id, 0, 0, false, 0, -28, false)
  3.     if tfm.get.room.objectList[id] then
  4.         dx = tfm.get.room.playerList["Jamesqwartz"].x - tfm.get.room.objectList[id].x
  5.         dy = (tfm.get.room.playerList["Jamesqwartz"].y-30) - tfm.get.room.objectList[id].y
  6.         distance = pythag(dx, dy)
  7.         tfm.exec.moveObject(id, 0, 0, false, (dx/1000)*(distance), (dy/1000)*(distance)-28, false)
  8.         print(tfm.get.room.objectList[id].vx)
  9.         print(i)
  10.         if distance>80 then
  11.             i=i+1
  12.         else
  13.             i=0
  14.         end
  15.         if i==7 and tfm.get.room.objectList[id].vx<math.abs(2) then
  16.             i=0
  17.             if dx>0 then
  18.                 tfm.exec.moveObject(id, tfm.get.room.playerList["Jamesqwartz"].x-25, tfm.get.room.playerList["Jamesqwartz"].y-25, false)
  19.             else
  20.                 tfm.exec.moveObject(id, tfm.get.room.playerList["Jamesqwartz"].x+25, tfm.get.room.playerList["Jamesqwartz"].y-25, false)
  21.             end
  22.         end
  23.     end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement