Hi,
i want to create two or more sprite maybe at the same location with arcade physics and i want that each member push back the other… i try without success.
I made a jsffidle about that :
https://jsfiddle.net/espace3d/1nps402y/
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#1b1464',
parent: 'phaser-example',
physics: {
default: 'arcade',
arcade: {
gravity: {
x: 0,
y: 100,
},
debug:true,
}
},
scene: {
preload: preload,
create: create,
update: update
}
};
var game = new Phaser.Game(config);
var o={};
function preload ()
{
this.load.image("block", "https://i.postimg.cc/KvY7DVGx/player.png");
}
function create ()
{
o.g = this.physics.add.group()
o.e = this.physics.add.sprite(100,100,"block").setBounce(1,1)
o.f = this.physics.add.sprite(140,120,"block").setBounce(1,1)
o.g.add(o.e)
o.g.add(o.f)
this.physics.add.collider(o.g, o.g);
}
function update ()
{
}
Could you help me please ?
Thanks.