我一直在使用 Sprite Kit 及其物理原理制作游戏,并在教程中遇到了这个结构:
struct PhysicsCategory
{
static let None: UInt32 = 0
static let All: UInt32 = UInt32.max
static let Player: UInt32 = 0b10
static let Obstacle: UInt32 = 0b11
}
谁能告诉我 0b01 等是什么意思,以及如何在这里创建一个新常量?
最佳答案
是hexa,也就是16个基数
六边形的 0b11 是
0 * 16^3 + 11 * 16^2 + 1 * 16^1 + 1 * 16^0 = 2816 + 16 + 1 = 2833
在六边形中,10、11、12、13、14、15等数字由a、b、c、d、e、f等字母表示
看here了解更多信息。
关于ios - Sprite Kit 中的物理类别结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31011788/