Jump to content

Velith

Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Velith's Achievements

Newbie

Newbie (1/14)

2

Reputation

  1. try with pivot like this : sprite.pivot.x = sprite.width / 2; sprite.pivot.y = sprite.height /2; or with anchor directly using : mySprite.anchor... and not mySprite.tileTransform.anchor (don't know what is tileTransform)
  2. You misunderstood Ivan anwser I think. TLDR : while(app.stage.children[0]) { app.stage.removeChild(app.stage.children[0]) } Problem with your code is that your remove element at a specific index during iteration, so you don't remove all elements. I think app.stage.removeChild() withotut parameter is equivalent to app.stage.removeChild(app.stage.children[0]), but can't check right now.
  3. Hi, It should be something like that : // 0. Listen which Pixi mouse event that you want (here PointerDown) stage.onPointerDown = (pixiEvent) => { // 1. Get the bone/constraint that you want to move using mouse const target = mySpineObject.skeleton.findBone("target"); // 2. Modify it's coordinate with the mouse event of pixi target.data.x = pixiEvent.data.global.x; target.data.y = pixiEvent.data.global.y; } Not test..
  4. Velith

    Pixi-layers.js

    It would be nice, thank you. Can you send me that in PM ? Yes I saw the wiki but i'm not sure that it's simpler than to use pixi-layers in my case. I have 2 mode that need to play with display order : - One that use 3 stages of parallax (background, main, foreground and in background for instance there is element farthest than others to made the parallax effect) - One isometric where the player position change the elements order around him (so each time his 'y' change, potentially I need to reorder some elements) What do you think ?
  5. Velith

    Pixi-layers.js

    I didn't notice the difference between http://pixijs.io/examples/#/layers/zorder.js and http://pixijs.io/examples/#/display/zorder.js The main problem was I forgot to replace the app.stage with the Pixi.Display.Stage. Thank you for your fast response :o. I update the answer in the original post
  6. Velith

    Pixi-layers.js

    Hi, First of all, I apologise for any mistakes in my english. EDIT (Solved) : I forgot to replace the "old" stage with the display one : app.stage = new PIXI.display.Stage(); and didn't notice the new 'layers' page http://pixijs.io/examples/#/layers/zorder.js (not http://pixijs.io/examples/#/display/zorder.js). My objective : I'm making an isometric game and I need to sort elements by Y coordinate. For instance, the player is moving and there is a tree : - I want to display the player after the tree when player.y > tree.y to make illusion that he is going IN FRONT OF the tree - And I want to display the player before the tree when player.y < tree.y to make illusion that is going BEHIND the tree. (I hope it's clear) Setup : Pixi v4.6.1, last pixi-layers.js Problem : I made this before with pixi-display.js and i try to do the same now with pixi-layers.js but I fail to do it (even with the old one). => zIndex is not taking into account, only the initial order (insertion order) is used. // Create the layer const sortedLayer = new PIXI.display.Layer(); // Player sprite const player = new PIXI.Sprite(resources["player"].texture); player.x = ... player.y = ... player.parentLayer = sortedLayer; stage.addChild(player); // Tree sprite const tree = new PIXI.Sprite(resources["tree"].texture); tree.x = ... tree.y = ... tree.parentLayer = sortedLayer; stage.addChild(tree); // Try to change his displayOrder (without success) player.zIndex = 2; tree.zIndex = 1; sortedLayer.group.enableSort = true; // From wiki, but display : "undefined" and in fact i do not see this method in the pixi-layers.js console.log(sortedLayer.displayChildren); I use : https://github.com/pixijs/pixi-display to implement this code and there is a bonus question about the "layer.displayChildren" that is undefined Is there something missing or the documentation is not updated ? I try to use Pixi.Display.Group either but no success. I know there is : http://pixijs.io/examples/#/display/zorder.js and i try to do it but failed (Because I think I didn't use the "stage.displayList = new PIXI.DisplayList" i just see it right now... maybe there is something like that i missed too in my example ?) Thanks for your help !
×
×
  • Create New...