Advertisement
SergioArmando

Untitled

Aug 4th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. local function onSetScore(event)
  2.     if gameIsActive == true then
  3.         if event.phase == "began" then
  4.             if event.other.myName == "arrow"  then
  5.                 if gameIsActive == true then
  6.                     local newScore = gameScore + 1
  7.  
  8.                     local arrowScore = display.newText("1",0,0,"Raleway-SemiBold", 15)
  9.                     arrowScore:setFillColor(r,g,b)
  10.                     arrowScore.x = event.other.x
  11.                     arrowScore.y = event.other.y - 10
  12.                     physics.addBody(arrowScore,"dynamic", {friction=10,density=10,bounce=10,radius=1, filter=obstaclesCollisionFilter})
  13.                     arrowScore:applyForce( 0, -10, event.other.x, event.other.y - 10 )
  14.  
  15.                     setScore(newScore)
  16.                     audio.play(sfx[3])             
  17.                     arrows[numArrows] = event.other.myName
  18.                 end
  19.             end
  20.         end
  21.     end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement