-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommunist.swift
More file actions
34 lines (25 loc) · 818 Bytes
/
Copy pathCommunist.swift
File metadata and controls
34 lines (25 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// Communist.swift
// HackCU4_Fail
//
// Created by Harsh Deshpande on 2/25/18.
// Copyright © 2018 hdeshpande. All rights reserved.
//
import SpriteKit
import GameplayKit
class Communist:SKSpriteNode{
let noCategory:UInt32 = 0
let laserCategory:UInt32 = 0b1
let playerCategory:UInt32 = 0b1 << 1
let enemyCategory:UInt32 = 0b1 << 2
let itemCategory:UInt32 = 0b1 << 3
func spawnLaser() {
let scene:SKScene = SKScene(fileNamed: "Laser")!
let laser = scene.childNode(withName: "laser")
laser?.position = self.position
laser?.move(toParent: self)
laser?.physicsBody?.categoryBitMask = laserCategory
laser?.physicsBody?.collisionBitMask = noCategory
laser?.physicsBody?.contactTestBitMask = enemyCategory
}
}