Jump to content

weapon.fireAngle does not work


qiao
 Share

Recommended Posts

excuse me,i have wrote the code below

 var weapon = game.add.weapon(30, 'bullet10');
    weapon.bulletKillType = Phaser.Weapon.KILL_DISTANCE;
    weapon.bulletKillDistance = 1000;
    //weapon.bulletSpeed = 500;
  //  weapon.fireRate = 600;
//    weapon.bulletGravity.y = -300;
    weapon.fireAngle = 180;
    weapon.bulletAngleOffset = 0;
    weapon.trackSprite(sprite, 5, 5, false);
    weapon.bullets.dam = 30000;
    weapon.bulletAngleVariance = 0;
    console.log(weapon.fireAngle);

but hte fireAngle dose not work,the bullet never change its angel in the page,why? bug?

thank you 

Link to comment
Share on other sites

  • 1 month later...

To be more specific, the source is here https://github.com/photonstorm/phaser/blob/master/src/plugins/weapon/WeaponPlugin.js

The important line:

var angle = (this.trackRotation) ? this.trackedSprite.angle : this.fireAngle;

Thus, this.trackRotation must be false for fireAngle to be used in fire() function.

SO...make sure you do not set trackRotation to true when using weapon trackSprite()

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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