bapereira

Flappy Bird

Oct 15th, 2019
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. --[[
  2. Project's author: Nettoork#0000
  3. ]]--
  4.  
  5. dataPlayer={}
  6.  
  7. function eventNewPlayer(name)
  8. dataPlayer[name]={
  9. maxPoints=0,
  10. },
  11. tfm.exec.bindKeyboard(name,32,true,true)
  12. end
  13.  
  14. timer = os.time();
  15. cano={}
  16. canos=0
  17. canex=0
  18. move=false
  19. nuvem={
  20. y=math.random(30,250),
  21. x=900,
  22. w=math.random(50,100),
  23. h=math.random(0,30),
  24. }
  25. function eventLoop() -- Sistema que Gera/Remove os canos
  26. if move then
  27. nuvem.x=nuvem.x-5
  28. tfm.exec.addPhysicObject(-1,nuvem.x,nuvem.y,{type=12,width=nuvem.w,height=nuvem.h,friction=81,restitution=99,color="0xFFFFFF",miceCollision=false,foreground=false})
  29. if nuvem.x <= (0-(nuvem.h+20)) then
  30. nuvem.y=math.random(30,250)
  31. nuvem.x=900
  32. w=math.random(50,100)
  33. h=math.random(10,30)
  34. end
  35. if timer < os.time()-3000 then
  36. canos=canos+1
  37. local canose={
  38. id=canos,
  39. x=850,
  40. alt=math.random(80,220),
  41. }
  42. table.insert(cano,canose)
  43. timer = os.time();
  44. end
  45. local insert=nil
  46. for i,v in pairs(cano) do
  47. v.x=v.x-35
  48. tfm.exec.addPhysicObject(i,v.x,v.alt/2,{type=12,width=50,height=v.alt,friction=81,restitution=99,color="0x17720F"})
  49. tfm.exec.addPhysicObject(i+10,v.x,v.alt-15,{type=12,width=72,height=40,friction=81,restitution=99,color="0x17720F"})
  50. tfm.exec.addPhysicObject(i+20,v.x,((400-v.alt)/2)+(v.alt+145),{type=12,width=50,height=400-v.alt,friction=81,restitution=99,color="0x17720F"})
  51. tfm.exec.addPhysicObject(i+30,v.x,v.alt+145,{type=12,width=72,height=40,friction=81,restitution=99,color="0x17720F"})
  52. if v.x <= -50 then
  53. insert=i+canex
  54. end
  55. for j,p in pairs(tfm.get.room.playerList) do
  56. if not p.isDead then
  57. if v.x == 115 then
  58. local px=tfm.get.room.playerList[j].x
  59. local py=tfm.get.room.playerList[j].y
  60. if py < v.alt+15 or py > v.alt+145 then
  61. tfm.exec.killPlayer(j)
  62. else
  63. tfm.exec.setPlayerScore(j,1,true)
  64. ui.addTextArea(1,"<font size='40' color='#FFFFFF'>"..tfm.get.room.playerList[j].score+1,j,400,30,0,0,1,1,0,true)
  65. end
  66. end
  67. end
  68. end
  69. end
  70. if insert~=nil then
  71. tfm.exec.removeObject(insert)
  72. tfm.exec.removeObject(insert+10)
  73. tfm.exec.removeObject(insert+20)
  74. tfm.exec.removeObject(insert+30)
  75. table.remove(cano, 1)
  76. canex=canex+1
  77. end
  78. end
  79. end
  80. function eventNewGame()
  81. cano={}
  82. canos=0
  83. canex=0
  84. for all in pairs(tfm.get.room.playerList) do
  85. tfm.exec.setPlayerScore(all,0,false)
  86. end
  87. ui.addTextArea(1,"<font size='40' color='#FFFFFF'>0",nil,400,30,0,0,1,1,0,true)
  88. move=true
  89. end
  90. function eventTextAreaCallback(id,name,link)
  91. if link == "close" then
  92. ui.removeTextArea(2,name)
  93. end
  94. end
  95. for a,b in pairs(tfm.get.room.playerList)do eventNewPlayer(a)end;function eventKeyboard(a,c,d,e,f)if c==32 then tfm.exec.movePlayer(a,0,0,true,0,-60,false)end end
  96. tfm.exec.disableAutoNewGame(true)
  97. tfm.exec.disableAutoShaman(true)
  98. tfm.exec.disableAutoTimeLeft(true)
  99. tfm.exec.disableAfkDeath(true)
  100. tfm.exec.disableAutoScore(true)
  101. tfm.exec.disablePhysicalConsumables(true)
  102. tfm.exec.disableMortCommand(true)
  103. tfm.exec.newGame('<C><P aie="" Ca="" /><Z><S><S P="0,0,0.3,0.2,0,0,0,0" L="800" o="1c9cdd" X="400" c="4" Y="200" T="12" H="400" /><S P="0,0,0,0,0,0,0,0" L="17" o="1c9cdd" H="400" Y="200" T="12" X="112" /><S L="17" o="1c9cdd" H="400" X="156" Y="200" T="12" P="0,0,0,0,0,0,0,0" /><S L="75" X="134" H="10" Y="-6" T="3" P="0,0,0,99,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="150" o="0B3707" X="79" c="4" Y="456" T="13" H="10" /><S H="10" L="150" o="0B3707" X="214" c="4" Y="463" T="13" P="0,0,0.3,0.2,0,0,0,0" /><S H="10" L="150" o="0B3707" X="358" c="4" Y="461" T="13" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="150" o="0B3707" X="506" c="4" Y="460" T="13" H="10" /><S H="10" L="150" o="0B3707" X="668" c="4" Y="460" T="13" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="150" o="0B3707" X="825" c="4" Y="457" T="13" H="10" /><S P="0,0,0.3,0.2,0,0,0,0" L="668" o="0B3707" X="444" c="4" Y="333" T="12" H="17" /><S H="10" L="150" o="0B3707" X="-49" c="4" Y="443" T="13" P="0,0,0.3,0.2,0,0,0,0" /></S><D><DS Y="133" X="134" /></D><O /></Z></C>')
Advertisement
Add Comment
Please, Sign In to add comment