diff --git a/snakegame.xcodeproj/project.xcworkspace/xcuserdata/halofourteen.xcuserdatad/UserInterfaceState.xcuserstate b/snakegame.xcodeproj/project.xcworkspace/xcuserdata/halofourteen.xcuserdatad/UserInterfaceState.xcuserstate index 0174019..8dcea81 100644 Binary files a/snakegame.xcodeproj/project.xcworkspace/xcuserdata/halofourteen.xcuserdatad/UserInterfaceState.xcuserstate and b/snakegame.xcodeproj/project.xcworkspace/xcuserdata/halofourteen.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/snakegame/GameScene.swift b/snakegame/GameScene.swift index 2f10bec..99ebd37 100644 --- a/snakegame/GameScene.swift +++ b/snakegame/GameScene.swift @@ -121,6 +121,19 @@ extension GameScene: SKPhysicsContactDelegate { snake.addBodyPart() apple?.removeFromParent() 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: break }