mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
The Weapon.fireRateVariance property was never taken into account internally. It's now applied to the firing rate correctly (thanks @noseglid #2715)
This commit is contained in:
parent
cbbb2cd97b
commit
19dbd8bba8
2 changed files with 18 additions and 1 deletions
|
@ -347,6 +347,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
|
|||
* Text bounds would incorrectly displace if the Text resolution was greater than 1 (thanks @valent-novem #2685)
|
||||
* TilemapParser would calculate widthInPixels and heightInPixels were being read incorrectly from JSON data (capitalisation of properties) (thanks @hexus #2691)
|
||||
* A tinted Texture in Canvas mode wouldn't be updated properly if it was also cropped, beyond the initial crop. Now a cropped texture will re-tint itself every time the crop is updated, and has changed (thanks @phoenixyjll #2688)
|
||||
* The Weapon.fireRateVariance property was never taken into account internally. It's now applied to the firing rate correctly (thanks @noseglid #2715)
|
||||
|
||||
### Pixi Updates
|
||||
|
||||
|
|
|
@ -895,7 +895,23 @@ Phaser.Weapon.prototype.fire = function (from, x, y) {
|
|||
bullet.body.velocity.set(moveX, moveY);
|
||||
bullet.body.gravity.set(this.bulletGravity.x, this.bulletGravity.y);
|
||||
|
||||
this._nextFire = this.game.time.now + this.fireRate;
|
||||
if (this.bulletSpeedVariance !== 0)
|
||||
{
|
||||
var rate = this.fireRate;
|
||||
|
||||
rate += Phaser.Math.between(-this.fireRateVariance, this.fireRateVariance);
|
||||
|
||||
if (rate < 0)
|
||||
{
|
||||
rate = 0;
|
||||
}
|
||||
|
||||
this._nextFire = this.game.time.now + rate;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._nextFire = this.game.time.now + this.fireRate;
|
||||
}
|
||||
|
||||
this.shots++;
|
||||
|
||||
|
|
Loading…
Reference in a new issue