Zeto

Members
  • Content Count

    6
  • Joined

  • Last visited

  1. good news I have found the perfect solution!!!!!!!!! I didn't know about this feature in HTML5 but there is a thing called "defer" and "async". Apparently all script tags with async will be run whenever they are loaded whilst the script having defer tag will be run in order AFTER all document is parsed and BEFORE document.onload. Hence the solution is: <head> <!--Code that doesn't care about order--> <script src="/lib/skills.js" async></script> <!--Code that cares about order--> <script src="/pixi/pixi.min.js" defer></script> <script src="/pixi/pixi-layers.js" defer></script> </head> @jonforum thank you for giving me a hint with the import and finding this absolute gem!!!!! To hell with the extra document onload loader
  2. @jonforum Here is what i don't understand: but at the end of the day, on the client side, we have to load pixi.js from the html and even having installed pixi.js and pixi-display from npm, they will also be needed to be loaded from html <script> which ends up with the same problem
  3. @jonforum Thank you for the reply! I have been using document.onload as well (and a similar function to yours too), but it makes the code very dense (and the page slightly slower) and have too many callbacks (have to track each api and when everything is done, then start the script). I think the solution I am looking at is have pixi.js and the apis in <head>, then modify the pixi-display.min.js file to delay the loading, and in document.onload have a function that loads it all. I thought this wasn't a developer friendly way at all, and pixi.js has been very developer friendly so I thought i was doing it the hard way! Maybe someone has a better trick!
  4. Hi everyone! I have been doing a lot of work with PIXI.js, and it is an absolute wonderful engine. However, I have had trouble with loading extra APIs such as pixi-display and pixi-multistyle-text synchronously in the head tag. I have managed to fixed the issue by loading the extensions once the document was fully loaded effectively inserting an extra asynchronous step, and then running the whole program. I was wondering if anyone had a better solution? Right now it is like this: load pixi.js and all document -> load pixi-display and all other apis -> run javascript And preferably, i was wondering if it would be possible to load pixi.js and pixi-display all together -> run javascript once document loaded
  5. Thank you! getLocalBounds was the function I was looking for. @ivan.popelyshev I don't quite understand your warning, but for the purpose of a simple sprite engine with no transformations whatsoever besides a simple horizontal scale = -1, it has been working well for me! Thank you xerver for the answer too! Cheers
  6. I know the devs of pixi.js browse this this forum, so just want to say thank you so much for pixi.js! It is an absolutely wonderful framework. I have a simple question and haven't been able to find the answer online. Containers have a width/height which is the total width and height of the sprites in the container, I think. Is there a minX/minY value for the sprites in the container, relative to the position of the container? For example, a container is set to position (20,20). Two sprites inside the container are set to (-10,-10,30,30) as (relX, relY, width, height), and (0,0,40,40). I believe that container.width will be 50, container.height will be 50. Is there a way to find the minX/minY relative to the container (-10,-10)? In other words, I would like to find the bounding rect of the sprites in a container relative to the container itself.