restart on wall hit #1
BIN
Binary file not shown.
@@ -121,6 +121,19 @@ extension GameScene: SKPhysicsContactDelegate {
|
|||||||
snake.addBodyPart()
|
snake.addBodyPart()
|
||||||
apple?.removeFromParent()
|
apple?.removeFromParent()
|
||||||
createApple()
|
createApple()
|
||||||
|
case CollisionCategories.EdgeBody:
|
||||||
|
scene?.removeAllChildren()
|
||||||
|
|
||||||
|
let counterClockwisePosition = CGPoint(x: frame.minX + 30, y: frame.minY + 30)
|
||||||
|
let clockwisePosition = CGPoint(x: frame.maxX - 80, y: frame.minY + 30)
|
||||||
|
|
||||||
|
addRotationButton(name: counterClockWiseButtonName, position: counterClockwisePosition)
|
||||||
|
addRotationButton(name: clockWiseButtonName, position: clockwisePosition)
|
||||||
|
|
||||||
|
snake = Snake(position: CGPoint(x: frame.midX, y: frame.midY))
|
||||||
|
addChild(snake)
|
||||||
|
createApple()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user