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


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...