Advertisement
Guest User

Untitled

a guest
Oct 16th, 2014
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. function setup()
  2. if1 = false
  3. rot = 360
  4. strawberry = {}
  5. s = Strawberries()
  6. be = Begin()
  7. floor = physics.body(EDGE,vec2(0,45),vec2(WIDTH,45))
  8. leftwall = physics.body(EDGE,vec2(45,HEIGHT+200),vec2(45,0))
  9. rightwall = physics.body(EDGE,vec2(WIDTH-45,0),vec2(WIDTH-45,HEIGHT+200))
  10. startJourney = false
  11.  
  12. jam = physics.body(POLYGON,vec2(0,0),vec2(0,1024/3-150), vec2(768/3-165,1024/3-150),vec2(0,0),vec2(768/3-165,0),vec2(768/3-165,1024/3-150))
  13. jam.x = WIDTH-200
  14. jam.y = 45
  15. jam.type = STATIC
  16.  
  17. if startJourney == true then
  18. floor:destroy()
  19. floor = nil
  20. leftwall:destroy()
  21. leftwall = nil
  22. rightwall:destroy()
  23. rightwall = nil
  24. jam:destroy()
  25. jam = nil
  26. end
  27.  
  28. end
  29.  
  30. function draw()
  31. -- This sets a dark background color
  32. background(40, 40, 50)
  33. if startJourney == false then
  34. sprite("Documents:BackgroundBrown",WIDTH/2,HEIGHT/2)
  35. -- This sets the line thickness
  36. popStyle()
  37. -- sprite("Documents:MainHero",WIDTH/2,HEIGHT/2)
  38. pushStyle()
  39. for a,b in pairs(strawberry) do
  40. b:draw()
  41. end
  42. music()
  43. -- Do your drawing here
  44. pushMatrix()
  45. translate(jam.x+50,jam.y+100)
  46. rotate(jam.angle)
  47. sprite("Documents:JamStraw",0,0,1024/3,768/3)
  48. -- sprite("Documents:JamStraw",WIDTH-150,145,1024/3,768/3)
  49. popMatrix()
  50. print (#strawberry)
  51. if #strawberry >6 then
  52. table.remove(strawberry,1)
  53. strawberry[1] = nil
  54. end
  55.  
  56. rot = rot - 0.1
  57. pushMatrix()
  58. sprite("Documents:Start",WIDTH/2,HEIGHT/2,1024/3,768/3)
  59. end
  60. if startJourney == false then
  61. if CurrentTouch.x > WIDTH/2-50 and CurrentTouch.y > HEIGHT/2-50 and CurrentTouch.x < WIDTH/2+50 and CurrentTouch.y < HEIGHT/2+50 then
  62. translate(WIDTH/2,HEIGHT/2)
  63. rotate(rot)
  64.  
  65.  
  66. startJourney = true
  67. else sprite("Documents:Start",WIDTH/2,HEIGHT/2,1024/3,768/3)
  68. rot = 360
  69. end
  70. end
  71. popMatrix()
  72. if startJourney == true then
  73. be:draw()
  74. end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement