admin管理员组文章数量:1023101
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.
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.
Share Improve this question edited Oct 2, 2019 at 15:25 user128511 asked Apr 18, 2018 at 17:47 eezeeeze 6481 gold badge7 silver badges23 bronze badges2 Answers
Reset to default 3You should use the PIXI.extras.TilingSprite
class, created for the purpose of rendering repeatable patterns, tiles, etc. The class uses only one quad (two triangles) for the whole pattern, repeating is achieved in the fragment shader.
Here is a working example: http://pixijs.io/examples/#/basics/tiling-sprite.js
Here is documentation: http://pixijs.download/release/docs/PIXI.extras.TilingSprite.html
TilingSprite
documentation / example has changed:
Example: https://pixijs.io/examples/#/sprite/tiling-sprite.js
Documentation: http://pixijs.download/release/docs/PIXI.TilingSprite.html
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.
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.
Share Improve this question edited Oct 2, 2019 at 15:25 user128511 asked Apr 18, 2018 at 17:47 eezeeeze 6481 gold badge7 silver badges23 bronze badges2 Answers
Reset to default 3You should use the PIXI.extras.TilingSprite
class, created for the purpose of rendering repeatable patterns, tiles, etc. The class uses only one quad (two triangles) for the whole pattern, repeating is achieved in the fragment shader.
Here is a working example: http://pixijs.io/examples/#/basics/tiling-sprite.js
Here is documentation: http://pixijs.download/release/docs/PIXI.extras.TilingSprite.html
TilingSprite
documentation / example has changed:
Example: https://pixijs.io/examples/#/sprite/tiling-sprite.js
Documentation: http://pixijs.download/release/docs/PIXI.TilingSprite.html
本文标签: javascriptPIXIjsscrolling background gridStack Overflow
版权声明:本文标题:javascript - PIXI.js - scrolling background grid - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745524044a2154442.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论