Jump to content

Best way to render 2x2 squares as fast as possible?


Bombardlos
 Share

Recommended Posts

I'm trying to make a cellular automaton using Pixi.js, and so I want it as fast as possible. Each 2 by 2 square is a unit called a bug that looks like this: bug.png.95abcdbbebdc65d44927500db79067fa.png (without the outline). The top right and bottom left will always be the same color, so on start I currently create 3 sprites based on a white square, put one that covers the whole bug and then one in the upper and lower corner on top of it, create a new container, put these 3 sprites in it, and run a loop that does this and puts each new container in a 2d array that represents the board. Then on each update cycle, I cycle thru the array and for each bug that needs to change, I get its 3 children by id and change their tint.

I am very new to Pixi, and to javascript for that matter. I've read thru the pixi API a lot trying to understand how it all works, but I'm not sure if I'm missing something in my methodology that may make it run faster. Any advice?

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...