Guest User

Untitled

a guest
Jul 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. if theBall.position.x <= theHole.position.x && theBall.position.y <= TheHole.position.y {
  2. addScore(Player: Player!)
  3. HideTheBall(theBallInTheHole: theBall)
  4. theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
  5. theBall.physicsBody?.angularVelocity = 0
  6. }
  7.  
  8. Ball.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
  9. if random == 0 {
  10. score[0] += 10
  11. }else {
  12. score[1] += 10
  13. }
  14. topLbl.text = "(score[1])"
  15. btmLbl.text = "(score[0])"
  16. }
  17. func HideTheBall(theBallInTheHole: SKSpriteNode) {
  18. theBallInTheHole.removeFromParent()
  19.  
  20. }
  21.  
  22. // Called before each frame is rendered
  23. StartScoring()
  24.  
  25. func BallinTheHole(theBall: SKSpriteNode, theHole:SKSpriteNode) {
  26. if theBall.position.x <= holeLB.position.x && theBall.position.y <= holeLB.position.y {
  27. addScore(Player: Player!)
  28. HideTheBall(theBallInTheHole: theBall)
  29. theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
  30. theBall.physicsBody?.angularVelocity = 0
  31. }
  32. }else if theHole == holeLT {
  33. if theBall.position.x <= holeLT.position.x && theBall.position.y >= holeLT.position.y {
  34. addScore(Player: Player!)
  35. HideTheBall(theBallInTheHole: theBall)
  36. theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
  37. theBall.physicsBody?.angularVelocity = 0
  38. }
  39. }else if theHole == holeRB {
  40. if theBall.position.x >= holeRB.position.x && theBall.position.y <= holeRB.position.y {
  41. addScore(Player: Player!)
  42. HideTheBall(theBallInTheHole: theBall)
  43. theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
  44. theBall.physicsBody?.angularVelocity = 0
  45. }
  46. }else if theHole == holeRT {
  47. if theBall.position.x >= holeRT.position.x && theBall.position.y >= holeRT.position.y {
  48. HideTheBall(theBallInTheHole: theBall)
  49. theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
  50. theBall.physicsBody?.angularVelocity = 0
  51. }
Add Comment
Please, Sign In to add comment