使用P2物理学在相位器中Sprite重叠时具有延迟的触发功能

时间:2018-10-28 14:29:11

标签: overlap phaser-framework

我想延迟2秒触发一个功能,该功能将我的球重置到标准位置并在击中球门时提高得分。

我的游戏是这样的:
Game screenshot

goal = game.add.sprite(35, 428, 'goal');
game.physics.p2.enable(goal, true);
goal.body.static = true;
goal.physicsBodyType = Phaser.Physics.P2JS;
goal.body.data.shapes[0].sensor = true;

var shape = new p2.Circle();
ball = game.add.sprite( game.world.centerX, game.world.centerY, 'ball');
game.physics.p2.enable(ball);
ball.anchor.setTo(0.5, 0.5);
ball.body.collideWorldBounds = true;
ball.body.data.gravityScale = 1;
ball.body.clearShapes();
ball.body.addCircle(shape);

我使用Arcade物理学中的Overlap函数一次,但是在P2中有什么等效功能吗?

0 个答案:

没有答案
相关问题