Hi,
I try to make a simple collision between a puck and a ball, with arcade engine,
but nothing happens.
here my simple code
var config = {
type: Phaser.AUTO,
backgroundColor: '#000000',
width: 400,
height: 650,
physics: {
default: 'arcade',
arcade: {
debug: true,
gravity: {
x: 0,
y: 0
},
}
},
scene: {
init: init,
create: create,
update: update,
}
};
var game = new Phaser.Game(config);
var ball;
var player2;
function init(){}
function create()
{
// ball
ball = this.add.circle((game.config.width/2), 100, 10, 0xffffff);
// player 2
player2 = this.add.circle((game.config.width/2), 150, 20, 0x840707).setStrokeStyle(10, 0xF30D0D);
this.input.setDraggable(player2.setInteractive());
this.input.on('drag', function (pointer, gameObject, dragX, dragY) {
gameObject.x = dragX;
gameObject.y = dragY;
});
// add physics
this.physics.add.existing(ball, false);
this.physics.add.existing(player2, false);
this.physics.add.collider(ball, player2);
}
function update()
{
}
Thanks