在精灵工具包

时间:2015-12-12 06:38:30

标签: swift sprite-kit skspritenode

我在SpriteKit项目中创建的是一个由大约160个精灵节点组成的大型二维平铺背景。但对我来说,这似乎效率极低。

将这些节点放在单个父节点下会使它们更有效吗?我会假设没有,在这种情况下,他们是一种在运行时将纹理本身组合成单个节点的方法吗?

我只是使用图像编辑器来平铺这些图像,但所述背景的大小会因设备之间的其他因素而在设备之间发生变化。

1 个答案:

答案 0 :(得分:2)

你可以做什么,在你的加载阶段,创建在1个父节点下创建背景所需的160个精灵节点,然后调用 $product = $this->Products->newEntity(); if ($this->request->is('post')) { $product = $this->Products->patchEntity($product, $this->request->data); if ($this->Products->save($product)) { $this->Flash->success(__('The product has been saved.')); return $this->redirect(['action' => 'index']); } else { $this->Flash->error(__('The product could not be saved. Please, try again.')); } } $this->set(compact('product')); $this->set('_serialize', ['product']); } ,并将此纹理用于你的BG精灵。当加载阶段结束时,160个精灵应该被破坏

相关问题