Trance

Members
  • Content Count

    13
  • Joined

  • Last visited

About Trance

  • Rank
    Member

Recent Profile Visitors

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

  1. Hi Lizard - thanks for the info, that's great! I'm guessing the Frame belongs to the Texture, rather than the instance of the image I'm creating? Because this method seems to work fine for the first copy of the image I create, but a second copy with a different size messes things up - it's changing the first image to the dimensions of the second (code snippet pasted below). Any idea how I might go about making this work with multiple copies of the image? var image1; var image2; image1 = this.add.image(400, 300, 'scroll'); image1.frame.height = 200; image1.frame.width = 200; image1.frame.cutHeight = 200; image1.frame.cutWidth = 200; image1.frame.updateUVs(); image2 = this.add.image(700, 300, 'scroll'); image2.frame.height = 32; image2.frame.width = 32; image2.frame.cutHeight = 32; image2.frame.cutWidth = 32; image2.frame.updateUVs();
  2. What property do I need to use to crop an image? I feel I must be missing something utterly obvious, but without any docs I'm a bit lost. I adding an image from a loaded texture thus: - this.add.image(x, y, image); The image is (say) 64 x 64 pixels, but I want to only display 32 x 32. Whatever property I set, it either has no effect at all, or it scales the image instead of cropping it. Could someone point me to the right property please?
  3. I don't understand what you mean by "behave differently" in this context. Isn't the whole point of that formula that the physics will behave the same at different dt? If dt is 20, the object will move twice as far as if dt was 10, because it's been twice as long since the last update - hence making the physics behave correctly regardless of how often Update() is called.
  4. Brilliant, thanks for the pointers @rich. I hadn't realised it didn't work under WebGL, so I guess I'll have to stick to using the Debug mode. Now if only I could work out why it stops drawing anything the second time the scene is entered!
  5. Aww dammit, I hate JavaScript. Thank you!
  6. Damn, that's bad news. There's no way to turn it on then? Failing that, I could get away with just using the debug drawing, but even that seems broken - it works the first time I load a scene, but on subsequent occasions it doesn't draw anything.
  7. @STuFF now I try out the PixelArt thing, it doesn't seem to work at all for me. I still get anti-aliased textures rather than crisp pixels with the config below. What am I doing differently to you? Are you definitely getting crisp pixels with this setup? var config = { type: Phaser.AUTO, width: 320, height: 200, zoom: 4, pixelart: true }; var game = new Phaser.Game(config);
  8. Thanks @Robmuh, but we're asking different questions. I'm trying to zoom the canvas to get a pixel art effect. So far nothing seems to work, I think I'm just going to have to scale all of my art manually.
  9. This is what I've tried so far, in the Create() of my second scene, to reset the zooming from 4 back to 1: - game.canvas.width = 1280; game.canvas.height = 800; game.canvas.style.width = ""; game.canvas.style.height = ""; game.renderer.resize(1280, 800, 1); The result is that the zooming is turned off, but I still only get a tiny portion of the screen being rendered up in the top-left. Any idea what property I might be missing to make this work?
  10. Does anyone know how I can get the Matter physics engine to render its geometry when running within Phaser? I.e. when I'm not assigning a sprite to a physics body, but I want the geometry of the objects I've created to be rendered as lines instead. If I set "debug" to true on the Matter config, I can see purple lines being rendered by the debugger. But if I set debug to false, I no longer see anything rendered. I've found there are a bunch of properties on the Matter "Body" object like StrokeStyle, LineWidth and FillStyle (described here) which seem designed for this purpose. However, I can't see equivalents for those in the Phaser documentation, and when I set the properties on the Matter body directly they seem to have no effect. Am I missing some simple piece of config or setup that I need to do, or have I stumbled across a bug or unsupported feature?
  11. Yeah, reading the source code has been invaluable. It does seem very well-structured, but my JavaScript is rusty enough to make it difficult to follow at times! Re. the canvas scaling... do you know if it would be possible to set this option per-scene, or even just to poke some properties somewhere to change it on the fly? Setting it once in the game config is great, but ideally I'd like more control.
  12. Wow... I never imagined it would be that simple! I'm struggling a little finding the right resources to research questions like this for myself, with Phaser 3 being so new, and the documentation being a little sparse right now. So thank you for the pointer!
  13. I'm trying to scale the whole Canvas up by 4x, for the purposes of a a pixel art styled game. I'm attempting to use the method outlined here: https://www.belenalbeza.com/articles/retro-crisp-pixel-art-in-phaser/ However, I can't seem to find the equivalent objects in Phaser 3. Could anyone point me in the right direction please?