Jump to content

Collide problem in P2 Physics


Recommended Posts


I am making a simple haxball clone and I have a problem. I have a player and a ball on the field, and there are field lines on top, left, right and bottom.

When player hits the ball, the ball sometimes goes out of the lines (it goes the other side when it should hit the line and come back). It generally happens when the ball goes fast. I thought it is a bug but I probably miss something because I am newbie on Phaser.

This is how I implemented a line:

this.topLine = this.add.sprite(400, 40, 'line');
this.topLine.scale.setTo(760, 2);
this.topLine.body.static = true;

And here is the ball implementation:

this.ball = this.add.sprite(400, 250, 'ball');
this.physics.p2.enable(this.ball, true);
this.ball.body.damping = 0.7;

I also added the images. Thanks in advance.



Edited by Ajora
unnecessary tags are deleted
Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...