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

时间:2017-03-24 04:59:57

标签: swift swift3 sprite-kit

我有超过8种不同的精灵类型,我想处理它们的冲突。我看到了this post,但我真的不明白这种方法,也不了解Objective-C。当我的精灵超过8时,我怎样才能迎合碰撞?

Gender

1 个答案:

答案 0 :(得分:2)

SpriteKit最多可以处理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