Advertisement
Tectoon

[TFM] Caixa para Prints

May 4th, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.41 KB | None | 0 0
  1. for i,key in ipairs({40,83}) do
  2. tfm.exec.bindKeyboard("Tectoon",key,true,true)
  3. end
  4.  
  5. downx=0
  6. downy=0
  7. leftx=0
  8. lefty=0
  9. rightx=0
  10. righty=0
  11. upx=0
  12. upy=0
  13.  
  14. bodyDef = {
  15.         type = 0,
  16.         width = 60,
  17.         height = 10,
  18.         foreground = false,
  19.         friction = 0,
  20.         restitution = 0.2,
  21.         angle = 0,
  22.         miceCollision = true,
  23.         groundCollision = false,
  24.         dynamic = false,
  25.         fixedRotation = true,
  26.         mass = 0,
  27.         linearDamping = 0,
  28.         angularDamping = 0
  29. }
  30.  
  31. function eventKeyboard(name,key,down,x,y)
  32.         -- cima e para baixo do solo
  33.         tfm.exec.removePhysicObject(1)
  34.         bodyDef.type=0
  35.         bodyDef.width=60
  36.         bodyDef.height=10
  37.         bodyDef.miceCollision = true
  38.         test = tfm.exec.addPhysicObject(1, x, y+20, bodyDef)
  39.         downx=x
  40.         downy=y+20
  41.         tfm.exec.removePhysicObject(4)
  42.         test = tfm.exec.addPhysicObject(4, x, y-30, bodyDef)
  43.         upx=x
  44.         upy=y-30
  45.        
  46.         -- chão esquerda e direita
  47.         tfm.exec.removePhysicObject(2)
  48.         bodyDef.type=0
  49.         bodyDef.width=10
  50.         bodyDef.height=60
  51.         bodyDef.miceCollision = true
  52.         test = tfm.exec.addPhysicObject(2, x-25, y-5, bodyDef)
  53.         leftx=x-25
  54.         lefty=y-5
  55.         tfm.exec.removePhysicObject(3)
  56.         test = tfm.exec.addPhysicObject(3, x+25, y-5, bodyDef)
  57.         rightx=x+25
  58.         righty=y-5
  59.        
  60.        
  61. end
  62.  
  63. function eventEmotePlayed(playerName,emote)
  64.         if emote==5 then
  65.                 -- cima e para baixo do solo
  66.                 tfm.exec.removePhysicObject(1)
  67.                 bodyDef.type=8
  68.                 bodyDef.width=60
  69.                 bodyDef.height=10
  70.                 bodyDef.miceCollision = false
  71.                 test = tfm.exec.addPhysicObject(1, downx, downy, bodyDef)
  72.                 tfm.exec.removePhysicObject(4)
  73.                 test = tfm.exec.addPhysicObject(4, upx, upy, bodyDef)
  74.                
  75.                 -- chão esquerda e direita
  76.                 tfm.exec.removePhysicObject(2)
  77.                 bodyDef.type=8
  78.                 bodyDef.width=10
  79.                 bodyDef.height=60
  80.                 bodyDef.miceCollision = false
  81.                 test = tfm.exec.addPhysicObject(2, leftx, lefty, bodyDef)
  82.                 tfm.exec.removePhysicObject(3)
  83.                 test = tfm.exec.addPhysicObject(3, rightx, righty, bodyDef)
  84.         end
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement