Search the Community
Showing results for tags 'stage.children'.
Found 2 results
Hello! First of all, as this is my first post and all, I would like to congratulate Mat and the team working on pixi.js. A few days ago I was looking for a nice and fast 2D game engine and I found yours here. I found it quite easy to understand and to implement, though at some times a bit daunting due to cross-version examples. However, I was able to start off a hobby project of mine quite fast. Speaking of which, I started an isometric map editor, you may see a very alpha (and buggy) version of it here. All is going well, but I am having a question regarding the following situation: The editor is meant to construct an isometric map by adding/moving around tiles. Each tile would have two sets of coordinates: - isometric x, y, z that would position each tile within the game's world-space. - regular x, y to be used for view-port rendering that get translated from the isometric coordinates. The problem I need to resolve now is the order of rendering the tiles. Obviously, tiles closer to the camera would obstruct the tiles further back, so I thought to set up a rendering order calculated from the isometric x, y coordinates, considering the farthest point as the x, y origin: var orderID = isometric.x + isometric.y * width The ID's produced this way are exemplified by the attached image. In theory, if I would be able to render the children based on the order of those ID's, the problem would be solved, and that would elegantly also resolve the problem of rendering a moving character the correct way in order to realistically show up behind or in front of columns, trees or other elements. A good solution for this would be the one proposed by tengotengo here. He suggests sorting the children array each time you make a modification to it. This solution would work great in the editor, but I was wondering if the sorting is by any chance too taxing for a game-play? I expect at some moments to have at least 20 players in the same room + several moving NPC's. Sorting and re-sorting the whole array each time one of them makes a move seems like a bad idea. So, I was wondering, would there be a better way of only moving up/down in the array the "dynamic" children?
Hello to all pixi fans I have a problem, when i reorder a DisplayObjectContainer's children array, the mouse events are not reordered (so it seems atleast). Here is the fiddle: http://jsfiddle.net/fela98/oer4828L/3/ The MouseEvents are not dispatched to the correct Sprites. Sometimes am I dragging a sprite that is behind the on I clicked. Am I supposed to reorder the children array manually or should i only do it with the swapChildren method? Am I doing something wrong or is this a bug? Thanks in advance!