Jump to content

Direction circle

Recommended Posts

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...