-
Content Count
2161 -
Joined
-
Last visited
-
Days Won
25
Everything posted by samme
-
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.
-
Calculate tween rotation time based on angular velocity
samme replied to feudalwars's topic in Phaser 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). -
You should try Chrome's CPU profiler. Here's a desktop profile:
- 13 replies
-
- low fps
- performance
-
(and 1 more)
Tagged with:
-
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; };
-
Will try, thanks.
-
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.
-
(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?
-
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
- 13 replies
-
I believe there's game.physics.arcade.checkCollision.bottom = false; game.physics.arcade.checkCollision.top = false;
-
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 });
-
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();
-
Draws properties of Arcade Physics bodies. Demo / Code npm i phaser-plugin-debug-arcade-physics
-
Prints Phaser’s display tree. Demo / GitHub / NPM npm i phaser-plugin-scene-graph