Advertisement
Guest User

Untitled

a guest
Jul 18th, 2016
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. -- eventLoop
  2. fireworks = true
  3. gameTime = 0
  4. pumpkin = nil
  5. nbPumpkins = 0
  6. ySpawn = 50
  7. function eventLoop(a, b)
  8. if gameTime%2 == 0 and fireworks == false then
  9. if pumpkin ~= nil then
  10. pumpkinObject = tfm.get.room.objectList[pumpkin]
  11. if pumpkinObject.y < 325 then
  12. tfm.exec.displayParticle(16, 400, 200, 0, 0, 0, -0.05, nil)
  13. tfm.exec.setPlayerScore(player, 10, true)
  14. ySpawn = ySpawn + 5
  15. else
  16. for i=0, 5 do
  17. tfm.exec.displayParticle(6, pumpkinObject.x, pumpkinObject.y, math.random(-1,1)*math.random()*math.random(), -math.random()*math.random(), 0, 0, nil)
  18. end
  19. end
  20. tfm.exec.removeObject(pumpkin)
  21. end
  22. if tfm.get.room.playerList[player].score + 10 >= 250 then
  23. system.bindMouse(player, false)
  24. tfm.exec.removeObject(trampoline)
  25. tfm.exec.setPlayerScore(player, nbPumpkins, false)
  26. fireworks = true
  27. else
  28. xRandom = math.random(35, 765)
  29. for i=0, 5 do
  30. tfm.exec.displayParticle(3, xRandom, ySpawn, math.random(-1,1)*math.random(), math.random(-1,1)*math.random(), 0, 0, nil)
  31. end
  32. pumpkin = tfm.exec.addShamanObject(89, xRandom, ySpawn, 0, math.random(-1,1), math.random(0,10), false)
  33. nbPumpkins = nbPumpkins + 1
  34. end
  35. elseif fireworks == true then
  36. xFeu = math.random(50,750)
  37. yFeu = math.random(50,350)
  38. kMax = math.random(20,50)
  39. for k=0,kMax do
  40. tfm.exec.displayParticle(5,xFeu,yFeu,math.random(-3,3)*math.random(),math.random(-3,3)*math.random(),0,0,nil)
  41. tfm.exec.displayParticle(5,xFeu,yFeu,math.random(-3,3)*math.random(),math.random(-3,3)*math.random(),0,0,nil)
  42. tfm.exec.displayParticle(5,xFeu,yFeu,math.random(-3,3)*math.random(),math.random(-3,3)*math.random(),0,0,nil)
  43. tfm.exec.displayParticle(5,xFeu,yFeu,math.random(-3,3)*math.random(),math.random(-3,3)*math.random(),0,0,nil)
  44. end
  45. end
  46. gameTime = gameTime + 0.5
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement