qiao Posted July 3, 2016 Share Posted July 3, 2016 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 More sharing options...
qiao Posted July 4, 2016 Author Share Posted July 4, 2016 until i read the source on git,i know that the fireangle works on some condition Link to comment Share on other sites More sharing options...
JTronLabs Posted August 17, 2016 Share Posted August 17, 2016 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 More sharing options...
Recommended Posts