Jump to content

Events for scrolling map


Dan335
 Share

Recommended Posts

I'm trying to set up mouse events to move an isometric map.  Everything I've tried breaks pixi.js' sprite events.

I have a container that holds the ground sprites and another for buildings.  It seems like I should put them on the ground container but then the building events don't work.

If I put a mousedown callback on both containers only the one for the ground fires even though it is rendering underneath the other container.

Link to comment
Share on other sites

I think I figure it out.  The world is divided up into areaContainers.  I turn their visibility off if they're not onscreen.

stage
  |-areaContainer
  |   |- groundContainer
  |   |- buildingContainer
  |
  |-areaContainer
  |   |- groundContainer
  |   |- buildingContainer
  |
  |-areaContainer
      |- groundContainer
      |- buildingContainer

needs to be

stage
  |- groundContainer
  |   |- areaContainer
  |   |- areaContainer
  |   |- areaContainer
  |
  |- buildingContainer
      |- areaContainer
      |- areaContainer
      |- areaContainer

 

Link to comment
Share on other sites

Hello! Which version of PIXI are you using? 

Unfortunately, I cant pinpoint your problem using that information. Yes, there are many problems with Interaction, and to solve them one must have a demo that reproduces the bug.

Please create a demo with few containers and sprites, with simple textures, that shows it.

btw, that thing can help you with ordering elements for rendering: https://github.com/pixijs/pixi-display

Link to comment
Share on other sites

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...