There is the following platform:
And a coin above it:
And the following code using arcade physics:
gravity: { y: 100, x: 10 }, - in config
function preload ()
{
this.load.image('platform', 'assets/platform.png');
this.load.image('star', 'assets/star.png');
}
function create ()
{
platforms = this.physics.add.staticGroup();
platforms.create(400, 568, 'platform');
player = this.physics.add.sprite(100, 450, 'star');
player.setCollideWorldBounds(true);
}
The code is approximate, a coin above the platform, sprites in png format. But the coin falls and does not roll, but moves horizontally, after which it falls again. How to make it "roll"?
UPD: Will it help me? https://github.com/photonstorm/phaser-examples/blob/master/examples/arcade%20physics/circle%20body.js And how to be with the platform?