In the game agar.io, there is a grid background, and It scrolls with the player as they move. In PIXI.js, how would I go about recreating this? Preferably, in an efficient way that does not waste resources by rendering off-screen grid.
答案 0 :(得分:1)
您应该使用PIXI.extras.TilingSprite
类,它是为了渲染可重复的图案,图块等而创建的。该类仅对整个图案使用一个四边形(两个三角形),在片段着色器中实现重复。
以下是一个工作示例:http://pixijs.io/examples/#/basics/tiling-sprite.js
以下是文档:http://pixijs.download/release/docs/PIXI.extras.TilingSprite.html
答案 1 :(得分:-1)
TilingSprite
文档/示例已更改:
示例:https://pixijs.io/examples/#/sprite/tiling-sprite.js
文档:http://pixijs.download/release/docs/PIXI.TilingSprite.html