Jump to content

How to rotate shoting arrow (groups)


Recommended Posts


I've got a problem with my game project.

I creted archer, he shoting arrows, but have problem with flying rotation (screen).

Arrow still flying straight (left), I would like to get right side effect (fly to up/down at an angle as in live).

Any idea ?

Sorry for my english, it's not my native language



Link to comment
Share on other sites

Thanks for answer but it's not help me.

I add lane here:

function firearrow() {
        reloadtxt.visible = true;
    } else{
        var arrow = arrows.getFirstExists(false);
        if (arrow) {
            arrow.reset(550, 410);
            arrow.body.velocity.x = 800;
            arrow.rotation = arrow.body.angle;
            game.physics.arcade.moveToPointer(arrow, 480);
    nextShot = game.time.now + 1000;

Effect: First few arrows fly without rotation (why ?), then there is rotation, but in the canvas: rotation is down and it has just been fired.


// Edit: 

My code group create

arrows = game.add.group();
        arrows.enableBody = true;
        arrows.physicsBodyType = Phaser.Physics.ARCADE;
        arrows.createMultiple(20, 'arrow');
        arrows.callAll('events.onOutOfBounds.add', 'events.onOutOfBounds', resetarrow);
        arrows.callAll('anchor.setTo', 'anchor', 0.5, 1.0);
        arrows.setAll('checkWorldBounds', true);


Link to comment
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...