Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if theBall.position.x <= theHole.position.x && theBall.position.y <= TheHole.position.y {
- addScore(Player: Player!)
- HideTheBall(theBallInTheHole: theBall)
- theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
- theBall.physicsBody?.angularVelocity = 0
- }
- Ball.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
- if random == 0 {
- score[0] += 10
- }else {
- score[1] += 10
- }
- topLbl.text = "(score[1])"
- btmLbl.text = "(score[0])"
- }
- func HideTheBall(theBallInTheHole: SKSpriteNode) {
- theBallInTheHole.removeFromParent()
- }
- // Called before each frame is rendered
- StartScoring()
- func BallinTheHole(theBall: SKSpriteNode, theHole:SKSpriteNode) {
- if theBall.position.x <= holeLB.position.x && theBall.position.y <= holeLB.position.y {
- addScore(Player: Player!)
- HideTheBall(theBallInTheHole: theBall)
- theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
- theBall.physicsBody?.angularVelocity = 0
- }
- }else if theHole == holeLT {
- if theBall.position.x <= holeLT.position.x && theBall.position.y >= holeLT.position.y {
- addScore(Player: Player!)
- HideTheBall(theBallInTheHole: theBall)
- theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
- theBall.physicsBody?.angularVelocity = 0
- }
- }else if theHole == holeRB {
- if theBall.position.x >= holeRB.position.x && theBall.position.y <= holeRB.position.y {
- addScore(Player: Player!)
- HideTheBall(theBallInTheHole: theBall)
- theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
- theBall.physicsBody?.angularVelocity = 0
- }
- }else if theHole == holeRT {
- if theBall.position.x >= holeRT.position.x && theBall.position.y >= holeRT.position.y {
- HideTheBall(theBallInTheHole: theBall)
- theBall.physicsBody?.velocity = CGVector(dx: 0, dy: 0)
- theBall.physicsBody?.angularVelocity = 0
- }
Add Comment
Please, Sign In to add comment