Phaser-Projectiles受重力影响

时间:2015-06-01 06:08:07

标签: html5 phaser-framework projectile

我在create函数中将gravity设置为1000,如下所示:

game.physics.arcade.gravity.y = 1000;

但是当我把弹丸放入其自身的功能中时:

function shootr(){
    if (canshoot) {
        if (attackTimer< game.time.now) {
            attackTimer = game.time.now + 500;
            var projectile;
            projectile = projectiles.create(
                player.body.x + player.body.width  / 2,
                player.body.y + player.body.height / 2,
                'powerball');

            game.physics.enable(projectile, Phaser.Physics.ARCADE);

            projectile.outOfBoundsKill = true;
            projectile.anchor.setTo(0.5, 0.5);
            projectile.body.velocity.x = 400;
        }
    }
} 

弹丸受到重力的影响,在弹丸发射时被拖到地面。我怎么做它让它直线射击,而其他物体射击受到重力的影响。

0 个答案:

没有答案