gauravD

Members
  • Content Count

    27
  • Joined

  • Last visited

About gauravD

  • Rank
    Member

Contact Methods

  • Website URL
    https://gaurav-dixitv.github.io/

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. gauravD

    p2js prismatic springs

    Okay. Fixed. http://jsfiddle.net/gauravdixitv/6acmp7h5/ Turns out Phaser uses physics.p2.pxmi (pxm inverse) to anchor a prismatic joint - https://github.com/photonstorm/phaser-ce/blob/master/src/physics/p2/PrismaticConstraint.js#L39 BUT, physics.p2.pxm to anchor a linear spring - https://github.com/photonstorm/phaser-ce/blob/master/src/physics/p2/Spring.js#L59 What is up with this ?
  2. You need to add the same angle constraints to bullet firing too. So instead of firing when the pointer is down, if (game.input.activePointer.isDown){ fire(); } you fire when the pointer is down and your sprite follows your angle constraints. if (game.input.activePointer.isDown && sprite.angle >= -90 && sprite.angle <=90){ fire(); }
  3. gauravD

    p2js prismatic springs

    You are right - works flawlessly in p2.js - http://www.physicstoy.com/383# Seems like the Phaser P2 plugin then. Will investigate some more today and get back to you!
  4. Like @casey said, animations (tweens) and timers will help you. An example - https://jsfiddle.net/gauravdixitv/L422hqk9/
  5. gauravD

    sending to back not working?

    Hi Casey. Children of a group will be rendered in the order in which they are added (unless of course you change the order with functions like sendToBack()). Because you add the background first, it will be rendered before everything else (so you don't need the call to sendToBack() on bg), and the text should appear on top - https://jsfiddle.net/gauravdixitv/r6v7sLkw/ Perhaps, you are changing the group's order somewhere else in your code?
  6. gauravD

    Problems due to world's scaling

    Oh right! I stand corrected
  7. gauravD

    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="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.min.js"></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 https://github.com/photonstorm/phaser-ce 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="https://cdnjs.cloudflare.com/ajax/libs/phaser-ce/2.9.4/phaser.min.js"></script>
  8. gauravD

    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?
  9. gauravD

    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: http://jsfiddle.net/gauravdixitv/83bkhr3f/ (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? :/
  10. gauravD

    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!
  11. gauravD

    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, game.world); With these changes in, check out : https://jsfiddle.net/gauravdixitv/tmnen92m/
  12. gauravD

    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 - https://jsfiddle.net/gauravdixitv/cb0z6yb7/
  13. gauravD

    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. https://jsfiddle.net/gauravdixitv/q3yjsk9e/ 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
  14. gauravD

    Phaser Boilerplate - Phaser.io + TypeScript + Webpack

    Looking good Costin! Aside from the webpack boilerplate, the prefab and helper templates will be helpful for new phaser+typescript developers
  15. gauravD

    TypeError: this.game.add is not a function

    Perhaps, you are looking for this.game.add.existing(). Try, this.game.add.existing(this.character);