Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. for i = 0; i<1000; ++i {
  2. var randomNumber = CGFloat(arc4random_uniform(3000)) * 200
  3. bubbleDuplicate.position = (CGPointMake(randomNumber, 400))
  4. bubbleDuplicate = bubble.copy() as! SKSpriteNode
  5. bubbleDuplicate.physicsBody?.categoryBitMask = bubbleCategory
  6. bubbleDuplicate.physicsBody?.collisionBitMask = 0
  7. bubbleDuplicate.physicsBody?.contactTestBitMask = 0
  8.  
  9. addChild(bubbleDuplicate)
  10.  
  11. func BubbleContact(){
  12. bubbleDuplicate.removeFromParent()
  13. bubble.removeFromParent()
  14. bubbleDuplicate.setScale(0)
  15. bubble.setScale(0)
  16.  
  17. }
  18.  
  19. }
  20.  
  21. func didBeginContact(contact: SKPhysicsContact) {
  22. let collision:UInt32 = (contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask)
  23.  
  24. if collision == (playerCategory | crateCategory) {
  25.  
  26. gameOver()
  27. }
  28. if collision == (playerCategory | bubbleCategory) {
  29. NSLog("Bubble Contact")
  30. bubbleDuplicate.removeAllActions()
  31. bubbleDuplicate.removeFromParent()
  32. bubble.removeAllActions()
  33. bubble.removeFromParent()
  34. bubbleDuplicate.setScale(0)
  35. bubble.setScale(0)
  36. bubbleDuplicate.alpha = 0
  37. bubble.removeFromParent()
  38. bubbleDuplicate.removeFromParent()
  39.  
  40. }
  41.  
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement