• Content Count

  • Joined

  • Last visited

About Owlzy

  • Rank

Recent Profile Visitors

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

  1. if I need to do something like this typically i'll fetch the manifest for the assets required for the minigame, load these assets through our asset manager, and then on leaving the game scene I will have kept this manifest (list of files I loaded) in memory, which I can then use to destroy and unload textures. regarding the duplicate keys, just delete them for (const key in keys) { if (keys.hasOwnProperty(key)) { delete PIXI.utils.TextureCache[key]; } }
  2. maybe this a silly question. but your not calling updateTransform() after setting the sprites x, y coordinates are you? I can't imagine a scenario where simply setting a few sprites coordinates would cause slow down...
  3. I don't see you update TweenJS in your code, most likely your problem. See their github, in the update loop - TWEEN.update(time); GSAP runs on its own ticker, Tweenjs doesn't, which is preferable is up for debate. Also no need to tween a plain object and then set the sprites position, pixi accesses x,y with a getter so you can just tween a sprite directly. Or otherwise you could just tween mySprite.position
  4. I forked someones codepen and set you up a quick example. A codepen is useful if your trying to collab with people. You will need something to animate it with, in this example I used TweenMax but there are lots of others. https://codepen.io/owlzy-the-vuer/pen/PBGMLy Have a little read of the code and try commenting out the line in the tweenmax onUpdate function where the emitters spawn position is set and you will see that the sprite is being animated by tweenmax, and I just use its position to set where the particles spawn. You could also add sprite.renderable = false; and the sprite will be hidden. You can then set up a more complex animation to achieve whatever effect your after.
  5. Owlzy

    Organising Code

    I'd say your code style is pretty decent, especially if your new to programming like you said, I've seen worse. Bit of slightly odd stuff with coding conventions going on is the only thing I could see. In JS generally functions start with lower case first word, with a capital letter for the first letter of any subsequent word. There was at least one function that wasn't in this style. Also I would normally use camel case for my js file names, is fairly minor though. Also in JS I always format my curly brackets like this for functions etc myFunction() { //some code } Although I have seen people format theirs as you do, in a more c style. Personally if I'm writing Java or JS I will do it in the above style, if c++ or c# I will use the format you do here. Again, not massively important, but its good to try and stick to conventions.
  6. Owlzy

    PIXI v5 and 3D

    Oh cool, never heard of that file format before. I was planning on implementing a .obj parser because I heard it was a very simple format. But I will check this out too.
  7. Owlzy

    PIXI v5 and 3D

    apologies, think I just needed a good nights sleep, I was being super dumb and missed out a whole load of steps! hello cube
  8. Owlzy

    PIXI v5 and 3D

    I know this is a bit premature as v5 is in pre-release stage. But basically I recently wrote a super simple 3d renderer in webgl which I had been attempting to hook into pixi, with limited success. A major problem I found was the fact the low level stuff was wrapped in the gl-core lib. Then I saw v5 was available for me to play around with, and I really love the way so much of this low level stuff is exposed to us now, I was straight away imagining all the crazy stuff we can do with it So I attempted to hook up my shaders and geometry to the new classes, in order to get a simple 3d cube demo working. I got something displayed fairly quickly, even the simple lighting shader I wrote seems to be working. However I hadn't yet added 3d projection and when I tried to do a projection transform on the model view matrix I just see grey background. I realise really I need to have another good dig through the source code for this, but do you guys have an idea how soon might there be a simple cube example on the examples page? Or otherwise is there something simple that it's likely I missed that would cause this? Sorry for the vagueness of my question but thanks in advance for taking a look and again, I really like where you guys are going with V5, good work chaps! and just for fun, here's a screen shot of my "cube" (I got mashup texture coords for some reason)
  9. I've done it previously just by taking the distance and angle between touch down and touch up points.
  10. It just that for a physics lib it makes sense that gravity should be negative, as gravity pulls not pushes, so I should think all physics libs do this. You can just use a negative value but I found it can get a bit complicated flipping the signs in your head if your using physics formulas a lot, programmer preference rlly. Both p2 and matter are full featured if you ask me, both would suit your needs fine I should imagine. The only thing I can actually remember from when I compared the two is that matter.js had a prettier website
  11. I solved it in the end, it turned out I wasn't actually rounding the values I meant to, that was causing lines when I moved the container when it was on non int coords. I was aware of the lib but it was this limitation that put me off. Thinking next time I might use your lib, save myself some stress! If it helps anyone else make sure you double check your rounding your container, and PIXI.SCALE_MODES.NEAREST on your tiles base texture is a good idea too.
  12. You need gravity, but just with pixi that will be a very low number and the gravity will currently act upwards. If you check the pen it should work as you expected, with the balls falling when you place them
  13. you were kinda doing it in a way I found confusing. On 2nd look I seem to of found your issue. Try this pen - With p2 I always use position[0] and position[1] for x,y values respectively , not sure you can access them with position.x
  14. Hmm it looks okay to me, intially I just thought you werent updating p2. One thing to be careful of though is as PIXI is y up, you might want to use a positive gravity or invert the stage by scaling y =-1. Couldn't see you invert the scene anywhere?
  15. Hi there, I'm working on a tile based game using PIXI but as it is a commercial project I can't share the code. I was hoping if I explained what I'm doing someone more experienced may be able to give me some input if it is something you have come across already? Initially had some issues with lines between tiles when moving the container that holds them, but this was resolved in a number of ways such as not using texture packer, PIXI.SCALE_MODES.NEAREST and making sure to round off the x, y values so they are always integers, simple enough to fix. Then having noticed was getting a poor fps on mobile I decided was time to optimise. Initially I tried culling tiles not in view, but I didn't notice a huge performance difference with this. So I decide I should use a render texture, and render the entire map container to the texture each frame. This gave me a huge boost when testing on mobile, I'm a happy man but then... the lines between tiles are back when moving the container... There are quite a few dynamic tiles such a platforms that move etc, hence why rendering the entire container. So my next step is to try and be smart and split it into two containers, static and dynamic, refresh the dynamic container and only update the static one when I need to (preferably just once at the beginning). Now I'm wondering if this would even work, as when I move the map container to move the player the static tiles, although they don't move individually, will still need updating every frame to get smooth movement. I want to stick with render textures as I feel this is the correct way to go about it, and that perfomance boost But wonder am I missing something here. The Tilingsprite class for instance is not one I understand well, I think perhaps I could use it here? Thanks and apologies for a long post without a specific question. Cheers, Owlzy