Swift 如何扩展SpriteKit中的最大类别位掩码

Swift 如何扩展SpriteKit中的最大类别位掩码,swift,swift3,sprite-kit,Swift,Swift3,Sprite Kit,我有超过8种不同的精灵类型,我想处理碰撞。我看到了,但我真的不理解方法,也不知道Objective-C。当我的精灵超过8时,我如何应对碰撞 let spriteCategory : UInt32 = 0x1 << 0 . . . let enemyPolyCategory : UInt32 = 0x1 << 8 let spriteCategory:UInt32=0x1Spr

我有超过8种不同的精灵类型,我想处理碰撞。我看到了,但我真的不理解方法,也不知道Objective-C。当我的精灵超过8时,我如何应对碰撞

let spriteCategory                : UInt32 = 0x1 << 0
       .
       .
       .
let enemyPolyCategory             : UInt32 = 0x1 << 8

let spriteCategory:UInt32=0x1SpriteKit最多可以处理32个不同的类别

static let hero: UInt32 = 0x1 << 0
static let ground: UInt32 = 0x1 << 1
static let obstacle: UInt32 = 0x1 << 2
...
static let potions: UInt32 = 0x1 << 30
static let warriors: UInt32 = 0x1 << 31

static-let-hero:UInt32=0x1SpriteKit最多可以处理32种不同的类别

static let hero: UInt32 = 0x1 << 0
static let ground: UInt32 = 0x1 << 1
static let obstacle: UInt32 = 0x1 << 2
...
static let potions: UInt32 = 0x1 << 30
static let warriors: UInt32 = 0x1 << 31

static let hero:UInt32=0x1谢谢,我没有很好地设置类别位掩码。还要记住,尽管只有32个不同的类别,但一个精灵可以有多个类别。因此,小型小行星
小行星
大型小行星
小型外星
外星
大型外星
类型的6个对象可以由4个类别表示-
小行星
外星
小型
大型
(您也可以有一个
中型
类别). 不过,这确实需要在didbeagin(联系人:)
中以不同方式处理。谢谢,我没有很好地设置类别位掩码。还要记住,尽管只有32个不同的类别,但一个精灵可以有多个类别。因此,小型小行星
小行星
大型小行星
小型外星
外星
大型外星
类型的6个对象可以由4个类别表示-
小行星
外星
小型
大型
(您也可以有一个
中型
类别). 但是,在
didbeagin(联系人:)
中确实需要以不同的方式处理此问题。