jobsboris27 Posted July 3, 2016 Share Posted July 3, 2016 Hi there! How can I sticky one ball(main ball) to another(little ball) and rotate synchronously for directional movement; It's like a weapon for player, when weapon rotate determines the direction of movement; function update() { player.body.angularVelocity = 0; if (cursors.up.isDown) { game.physics.arcade.velocityFromAngle(player.angle, PLAYER_SPEED + PLAYER_ACCELERATION, player.body.velocity); } ball.anchor.setTo(1, 1); ball.body.x = player.body.x; ball.body.y = player.body.y; if (cursors.left.isDown) { ball.angle -= 0.05 * 100; //bug player.body.angularVelocity = -PLAYER_SPEED_ROTATE_WITH_BALL; } else if (cursors.right.isDown) { ball.angle += 0.05 * 100; //bug player.body.angularVelocity = PLAYER_SPEED_ROTATE_WITH_BALL; } } Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted July 3, 2016 Share Posted July 3, 2016 The angle of the Body in radians Link to comment Share on other sites More sharing options...
Recommended Posts