Search the Community

Showing results for tags 'onbegincontact'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 4 results

  1. if (bodyA === null) { return; } if(equation[0].bodyA.parent.sprite.key!=='hit') { equation[0].bodyA.parent.sprite.key.body.destroy(); } if(equation[0].bodyB.parent.sprite.key!=='hit') { equation[0].bodyB.parent.sprite.key.body.destroy(); } anyone help to destroy the body... i got error on destroy line or here how can set safeDestroy as true
  2. scofieldly

    onbegincontact not work

    Hi all, I want to use p2 onbegincontact to detect 2 p2 body overlap and want to do some actions, I tried to write like this body1.onBeginContact.add(func, this); but it seems when it overlap another body, the callback func did not run. is there any tips for using this event, thanks.
  3. deedeekaka

    onBeginContact not firing every time

    Hello, Making a basket ball game and I want to increase the score when I detect that the ball has been sunk in the basket. I place a rectangular sensor body under the net so it doesn't stop the ball from passing through it but can detect collisions. I create the sensor in the create() function: //Setting up checker physics this.game.physics.p2.enable(this.checker, true); this.checker.body.data.shapes[0].sensor = true; this.checker.body.static = true; And I add this onBeginContact callback, also in the create() function: this.checker.body.onBeginContact.add(this.checkIfScored, this); And since I only want to increase the score if the ball is travelling downwards through the net: checkIfScored : function () { console.log(this.ball.body.velocity.y); if (this.ball.body.velocity.y > 0) { console.log("SCORED!"); this.score++; this.scoreText.setText('Score: ' + this.score); } } My problem is: onBeginContact is only firing on the ball's way up, but it doesn't fire again on the way down and I don't know why. You can see the image below of it's setup on the stage. I've been in and out of the forums, digging for an answer. Any help is very much appreciated!!
  4. at first my code working alright then I tried to add collisionGroup to all the sprites there is. Because I usually declare classes outside the create function I must move them inside because collisionGroup can only be created after the physics has been initiated which must be initiated inside the create function. After I finish all that an error occur onBeginContact is giving a null on it's first parameter which is strange because it should be giving a body under all circumstances. The second and third parameter is given as usual but I don't know if it's out of the ordinary because i never use those parameters. What cause this ?