Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function eventLoop()
- tfm.exec.moveObject(id, 0, 0, false, 0, -28, false)
- if tfm.get.room.objectList[id] then
- dx = tfm.get.room.playerList["Jamesqwartz"].x - tfm.get.room.objectList[id].x
- dy = (tfm.get.room.playerList["Jamesqwartz"].y-30) - tfm.get.room.objectList[id].y
- distance = pythag(dx, dy)
- tfm.exec.moveObject(id, 0, 0, false, (dx/1000)*(distance), (dy/1000)*(distance)-28, false)
- print(tfm.get.room.objectList[id].vx)
- print(i)
- if distance>80 then
- i=i+1
- else
- i=0
- end
- if i==7 and tfm.get.room.objectList[id].vx<math.abs(2) then
- i=0
- if dx>0 then
- tfm.exec.moveObject(id, tfm.get.room.playerList["Jamesqwartz"].x-25, tfm.get.room.playerList["Jamesqwartz"].y-25, false)
- else
- tfm.exec.moveObject(id, tfm.get.room.playerList["Jamesqwartz"].x+25, tfm.get.room.playerList["Jamesqwartz"].y-25, false)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement