# samme

Members

2160

24

1. ## Calculate tween rotation time based on angular velocity

Hi feudalwars, body.angularVelocity, body.maxAngular, and body.rotation are actually in degrees, not radians (the docs are wrong there). sprite.rotation is in radians. I'd thought there was a Phaser function giving the smallest difference of two angles but I can't find it now. When angles wrap the absolute difference may not be the smallest one: e.g., from 359° to 1° should be +2° (clockwise), not -358° (anticlockwise).
2. ## low FPS on mobile, problem with performance

You should try Chrome's CPU profiler. Here's a desktop profile:
3. ## Check Sprites/Objects in range

The invisible sprite method is good. I've also used var distanceBetween = Phaser.Physics.Arcade.prototype.distanceBetween; Phaser.Physics.Arcade.Body.prototype.distanceTo = function(target) { return distanceBetween(this.center, target.body.center); }; Phaser.Physics.Arcade.Body.prototype.isBeyond = function(range, target) { return this.distanceTo(target) > range; }; Phaser.Physics.Arcade.Body.prototype.isWithin = function(range, target) { return this.distanceTo(target) <= range; };
4. ## Clip a texture to a rotating sprite?

Will try, thanks.
5. ## Clip a texture to a rotating sprite?

Hi symof, I mean that the shadow should be clipped to the asteroid (panels 6–7) instead of overflowing it (panels 3–4). It's like http://phaser.io/examples/v2/bitmapdata/alpha-mask but I need to rotate the mask continuously without rotating the shadow texture beneath it.
6. ## Clip a texture to a rotating sprite?

(1) an asteroid texture (2) a shadow texture (3) shadow covers asteroid (4) asteroid rotates but shadow doesn't shadow clips to asteroid's outline (5, 6) at its current rotation (7) end result I'm stuck at #5–6. Ideas?
7. ## Texture Atlas Creator

Glue is neat. glue ./images ./atlas --json # -> atlas/images.png # -> atlas/images.json # Descend into folders: glue ./images ./atlas --json --recursive # Make 1 atlas per folder: glue ./images ./atlas --json --project
8. ## Phaser Scene Graph plugin

Done! https://github.com/samme/phaser-plugin-scene-graph
9. ## Phaser Scene Graph plugin

Sure, post the modified source.

11. ## Phaser Scene Graph plugin

Now with filter and map: game.debug.graph(obj, { // options: collapse: true, filter: null, // function (obj) -> true || false map: null, // function (obj) -> "description" skipDead: false, skipNonexisting: false });
12. ## Phaser Debug Arcade Physics plugin

Now with blocked, touching, and bodyDisabled.
13. ## Phaser Scene Graph plugin

Here's a snippet to quickly look at a running game (run in console): (this.game || Phaser.GAMES[0]).load.script("SceneGraph", "https://samme.github.io/phaser-plugin-scene-graph/SceneGraph.js", function (){ this.game.plugins.add(Phaser.Plugin.SceneGraph).graph(); }).start();
14. ## Phaser Debug Arcade Physics plugin

Draws properties of Arcade Physics bodies. Demo / Code npm i phaser-plugin-debug-arcade-physics
15. ## Phaser Scene Graph plugin

Prints Phaser’s display tree. Demo / GitHub / NPM npm i phaser-plugin-scene-graph