This commit is contained in:
Yuriy Mayatnikov
2020-06-30 15:20:47 +03:00
parent c8123ca15f
commit 413cad5d3c
21 changed files with 998 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
//
// Apple.swift
// snakegame
//
// Created by Nik Rodionov on 23.06.2020.
// Copyright © 2020 nrodionov. All rights reserved.
//
import SpriteKit
class Apple: SKShapeNode {
convenience init(position: CGPoint) {
self.init()
path = UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: 10, height: 10)).cgPath
fillColor = .red
strokeColor = .red
lineWidth = 5
self.position = position
physicsBody = SKPhysicsBody(circleOfRadius: 10.0, center:CGPoint(x: 5, y: 5))
physicsBody?.categoryBitMask = CollisionCategories.Apple
}
}