const INDEX_FORMAT := globals.INDEX_FORMAT static func ByteArray(size: int) -> PoolByteArray: var arr := PoolByteArray() arr.resize(size) return arr static func _4bpp_to_tile(data: PoolByteArray) -> Image: var tdata := ByteArray(64) for i in range(32): tdata[i*2] = data[i] % 16 tdata[i*2+1] = data[i] / 16 var tile := Image.new() tile.create_from_data(8, 8, false, INDEX_FORMAT, tdata) return tile