• Content count

  • Joined

  • Last visited

About gauravD

  • Rank

Contact Methods

  • Website URL
  1. Problems due to world's scaling

    Cool Your fiddle was using an older version. You can always check what version you are using - Phaser prints it in your console! Um, depends on how you are including it. It might look like <script type="text/javascript" src=""></script> //Or If you have downloaded the source, it could be something like: <script type="text/javascript" src="../libs/phaser/phaser.min.js"></script> You can update to phaser-ce by 1. Grabbing the latest source from and including it in your project ( with something like <script type="text/javascript" src="../libs/phaser/phaser.min.js"></script>) OR 2. Pointing to a newer phaser source with <script type="text/javascript" src=""></script>
  2. WebGl performance on mobile

    It does render quads. But it uploads the entire buffer every frame - come to think of it, this will usually be necessary if all/most objects in the scene move. I was working on a game where a few hundred quads would remain static throughout and other objects (quads) moved. Uploading just the bufferSubData() helped me with performance significantly! Also, are you using multi texture batching? You might also want to try Phaser 2.6.2; Apparently, it performs much better than the current ce version. PS Could you please check the number of draw calls you get with webGL?
  3. p2js prismatic springs

    Hi. Prismatic and Spring joints in p2js seem pretty straightforward. I was wondering why using constant rest length, stiffness and damping for a spring would change its behavior when a body's local anchor is changed. Fiddle: (phaser/p2js template from inkfood) From the fiddle, all the springs use share the same parameters except the local anchor of body A. Why do the springs behave differently? :/
  4. WebGl performance on mobile

    Hey. Poor webGL performance could be due to a few things aside from phaser.debug. Because your scene is large, it might be due to Phaser(pixi) uploading entire buffers on the GPU every render frame. Perhaps, some profiling could help you? Check out #356!
  5. Problems due to world's scaling

    Hi Tom. Camera follow has been fixed in a newer version of Phaser. You should update to either phaser-ce or 2.6.2 Because you move the camera around, the pointer's arctan to the player will not be computed correctly if you use the pointer's local (x,y). You need the arctan from the pointer's (x,y) in world coordinates. Passing the world to moveToPointer(), will use the pointer's world coordinates (this is not intuitive, I know). game.physics.arcade.angleToPointer(player, game.input.activePointer,; With these changes in, check out :
  6. P2 physics overflow static body

    Hi wexing. What do you mean by overflow? The ball slightly entering the right_hoop ? This might be due to tunnelling. AFAIK, p2js only partially supports Continuous Collision Detection, if at all. Making the hoop rects slightly wider, will help -
  7. Phaser P2 Physics going weird?

    Hey Teonnyn. You get this behavior because the point (X, Y) is on the physics world boundary. If your body is set to collide with world boundaries (which it is by default), and you create it on the boundary, the collision will force the body out with an impulse. set the variable center to false, and you will see the ball behaving like it does in your code. If you want your ball to come in from outside, make the world bigger
  8. Phaser Boilerplate - + TypeScript + Webpack

    Looking good Costin! Aside from the webpack boilerplate, the prefab and helper templates will be helpful for new phaser+typescript developers
  9. TypeError: is not a function

    Perhaps, you are looking for Try,;
  10. destroy and reset a State

    You can reset all your variables in the state's shutdown() and then call game.state.restart() (saves you the trip to Gameover too :)).
  11. Phaser creating state in same file typescript error

    You are using Typescript; Why not make use of the awesome things it adds to JS? Take a look at for a complete project template that uses Typescript and Phaser. You could create a state (boot.ts) like so: export class Boot extends Phaser.State { public preload(): void { } /** * Use this to set global properties such as resolution, aspect ratio, et cetera. * * * @memberOf Boot */ public create(): void { this.input.maxPointers = 1; //multi-touch needed? this.stage.disableVisibilityChange = false; = true; = true; if ( { //Desktop settings } else {, false); = Phaser.ScaleManager.SHOW_ALL } /*if (DEBUG) { console.log("Done booting up!"); console.log("Revision : " + GIT_REVISION); }*/ } } Then, import { Boot } from './states/boot' export class Game extends Phaser.Game { /** * Creates an instance of Game. * @param {Phaser.IGameConfig} config * * @memberOf Game */ constructor(config: Phaser.IGameConfig) { super(config); //Add states this.state.add('Boot', new Boot(), false); } /** * Boots game by starting the boot state. * * @memberOf Game */ public bootGame(): void { //Boot this.state.start('Boot'); } }
  12. Black lines appearing when using a texture for tilesprite

    Turning off antialiasing should get rid of those lines for now. Of course, this should not be the solution - I will take a look and report back if I find anything.
  13. Text taking click without adding input

    The text objects accept input because they are added as the button's children: In your case, the hierarchy also seems a bit incorrect logically. The texts and the button should have a common parent (perhaps, call it a TextButton ). //TextButton pseudocode TextButton : Sprite { titleText: Phaser.Text //TOP_CENTER descText: Phaser.Text //CENTER button: Phaser.Button //BOTTOM_CENTER TextButton(){ this.addChild(titleText); this.addChild(button); this.addChild(descText); } }
  14. How to double jump with phaser ?

    @samme's answer should work just fine. Regardless, since jump1() and jump2() are equivalent, why not just use jump()?