Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by fazz

  1. Thanks @Milton, @rich. It wasn't quite as trivial as I'd hoped, so I've probably gone around the houses with my solution. In case anyone's interested, I added the following method to the TextureManager to provide getPixels functionality. /** * Given a Texture this method will return an Object containing w, h and Uint8ClampedArray * of pixel data at the location in the Texture. * * @param {string} key - The unique string-based key of the Texture. * @param {(string|integer)} frame - The string or index of the Frame. * * @return An object populated with t
  2. I don't think you're testing input on the cookie correctly, you're passing *this* instead of *this.cookie* to your handler method. Try this instead, this.cookie = this.physics.add.sprite(400, 400, "cookie"); this.cookie.setInteractive(); this.cookie.on('pointerup', function() { // do something to the cookie this.doSomething(); }, this.cookie);
  3. Hi all, I have been unable to find a method to get all the pixel data from a cached image / texture in Phaser 3. Is anyone aware of a way? I am aware of the textures.getPixel method https://photonstorm.github.io/phaser3-docs/Phaser.Textures.TextureManager.html#getPixel__anchor but this is only a single pixel method, is incredibly inefficient / slow when iterating across a whole image. There were a number of ways to get all the image pixel data in Phaser 2 in one go; you could use getPixels from a renderTexture or a bitmapData.context. There is no such method in Phaser3 renderTex
  4. You'll need to look at a wider area than that, and make sure you're covering the part of the game that runs slowly in your mobile browser. Then expand some of those functions (see the little grey arrow next to Gecko), looks at what methods are being called, and then look at your code to see why it might be running slowly. Optimisation is an open ended problem. Without seeing your code it is quite difficult to offer any advice.
  5. That's pretty normal. Even a top spec mobile is going to struggle against an average PC. I mainly use FF, but Chrome definitely has a performance tool. Just run it on desktop, see what methods top your flame chart / call tree, and optimise those. In FF it gives you a handy percentage total performance cost for each function over the selected period. They might not be the exact issue with your mobile performance but they might be a good indicator.
  6. You're game is topdown so you'd need friction to work in the Z direction, not X and Y. Without seeing your code it's hard to tell, but depending on what Physics you're using you might be able to use setFrictionAir to slow your cars down. Player1.setFrictionAir(1); Failing that you might have to roll your own Z friction.
  7. I believe you need to load the assets when the scene starts. You can create objects whenever you like, but the assets need to be loaded first. If you want to load the same scene with different assets, you could pass data to the scene when you start it, and use that data to define which assets to load. An example of passing data to a scene can be found here https://labs.phaser.io/edit.html?src=src\scenes\passing data to a scene.js
  8. Hi, Might this help https://github.com/samme/phaser3-faq/wiki#how-do-i-load-cross-origin-assets
  9. Hi, I think I've found an issue with the normal map spot light. Either that or I've done something daft in my code. I believe the spot light system correctly selects which pixels to illuminate, but it doesn't consider the sprite's rotation, only the pixel normal value, when calculating per pixel lightness. This only becomes apparent when a sprite is rotated, and it is difficult to demonstrate when using very flat normal maps, like in this spot light demo http://labs.phaser.io/view.html?src=src\game objects\lights\spotlight.js You can see my below code snippet running here https:
  10. fazz

    Sphere rotation

    Apologies for the necropost. I've been adapting your http://phaser.io/sandbox/kQxhfHbb for a project of mine. I wanted to slow the movement of the bitmapData object. In the update function there is the code, earthBMD.move(-1,0); If I adjust that to -0.1 the image blurs. It seems that http://phaser.io/docs/2.6.2/Phaser.BitmapData.html#move only operates correctly with integer values. Can anyone recommend a workaround for this? I can slow the movement by only calling the above code a few times a second, rather than every frame, and although this does slow the movement, it p
  • Create New...