DougCp

Platform delete

May 13th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tfm.exec.disableAutoShaman(true)
  2.  
  3. players = {}
  4. function INIT()
  5.     started = false
  6.     tfm.exec.newGame('<C><P /><Z><S><S P="0,0,0.3,0.2,0,0,0,0" L="198" o="8a1a1a" H="79" X="294" Y="274" T="12" lua="0" /><S P="0,0,0.3,0.2,0,0,0,0" L="198" o="116189" lua="1" X="511" Y="274" T="12" H="79" /><S P="0,0,0,0,0,0,0,0" L="11" o="ffffffff" H="385" Y="214" T="12" X="190" /><S L="11" o="ffffffff" H="385" X="615" Y="214" T="12" P="0,0,0,0,0,0,0,0" /></S><D><DS Y="-9" X="400" /></D><O /></Z></C>')
  7.     for name,player in pairs (tfm.get.room.playerList) do
  8.         players[name] = {x = tfm.get.room.playerList[name].x} -- puts coordinates in table (for each player)
  9.     end
  10. end
  11.  
  12. function getCoords()
  13.     m = 0
  14.     n = 0
  15.         for name,player in pairs(tfm.get.room.playerList) do
  16.             if (players[name].x >= 195 and players[name].x <= 392) then -- checks coordinates and count mice
  17.                 m = m + 1
  18.             else
  19.                 n = n + 1
  20.             end
  21.         return n, m
  22.         end
  23. end
  24.  
  25.  
  26. function removePlatform()
  27.     getCoords()
  28.     if m > n then -- compares the number of mice on platforms
  29.         tfm.exec.removePhysicObject(0)
  30.     else
  31.         tfm.exec.removePhysicObject(1)
  32.     end
  33. end
  34.  
  35. sec = 10
  36. function eventLoop() --timer
  37.     sec = sec - 0.5
  38.     if sec == 0 then
  39.         started = true
  40.         removePlatform()
  41.     end
  42. end
  43.  
  44. INIT ()
Add Comment
Please, Sign In to add comment