samme

Members
  • Content Count

    2161
  • Joined

  • Last visited

  • Days Won

    25

Everything posted by samme

  1. Are you using arcade.collide or arcade.overlap? collide should separate the two bodies so they collide for only 1 frame. For arcade.overlap, Phaser doesn't trigger anything when the overlap ends, but you can track it yourself with body.touching.none and body.wasTouching.none.
  2. 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).
  3. You should try Chrome's CPU profiler. Here's a desktop profile:
  4. 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; };
  5. 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. (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. 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. Done! https://github.com/samme/phaser-plugin-scene-graph
  9. Sure, post the modified source.
  10. I believe there's game.physics.arcade.checkCollision.bottom = false; game.physics.arcade.checkCollision.top = false;
  11. 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. Now with blocked, touching, and bodyDisabled.
  13. 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. Draws properties of Arcade Physics bodies. Demo / Code npm i phaser-plugin-debug-arcade-physics
  15. Prints Phaser’s display tree. Demo / GitHub / NPM npm i phaser-plugin-scene-graph