Jump to content

render background container only once


JeanLouis
 Share

Recommended Posts

Hello,

Let's say I have 2 containers :

- background, to display the map (land and water, basically) -> zIndex 0
- entities (npc, buildings..) -> zIndex > 0 (from 1 to 100)

I would like to avoid to draw background each time on the loop, because this background actually never changes. The entities are drawn in front of the background, and they can change, for example when a NPC move.

Before using PIXI I had multiples canvases, one for the background, and the others for the entities, and the entities canvases were drawn in front of the background one. This way, I could draw background only one time and then, do whatever I want with the second canvas (clearing the entities canvas doesn't affect the background canvas).

So I would like to do the same with PIXI but would it be possible to draw background only once, keep it displayed, and render the entities on each loop ?

Please note that I use webworker, so if I understand well, I can use only PIXI.Application, because the others classes don't have the view option - in my case, I have to send the offscreencanvas to the worker :)

Thanks !

Edited by JeanLouis
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...