Change bullet speed on the fly


#1

I’m implementing some sort of fast rewind mode for my game. I’ve managed to ‘speed up’ tween used in the game. To do so, I’m changing player.tween.timeScale property of sprite’s tween.
Now I’m facing a problem to change speed of bullets when they were already shooted from weapon. Question is how to get access to tween of bullet? Bullet moves by tweening, right?

Code for weapon:

weapon = this.game.add.weapon(20, 'bullet');
weapon.bulletKillType = Phaser.Weapon.KILL_WORLD_BOUNDS;
weapon.bulletAngleOffset = 0;
weapon.bulletSpeed = bulletSpeed;
weapon.fireAngle = Phaser.ANGLE_RIGHT; // shoot at right direction by default
weapon.trackSprite(player, 0, -9, false);

#2

AFAIK, bullets are managed with the weapon class, if you want to change the speed maybe you should look at this example https://phaser.io/examples/v2/weapon/bullet-speed-variance and continue playing with weapon.bulletSpeed until you get it


#3

It is not my case, because I want to change speed during the flight of bullet.
I already know how to get reference to flying bullet, but don’t know how to reference its tween object.
What causes bullet to fly?


#4

Bullets use Arcade Physics.


#5

@samme, thank you for more general solution with time.slowMotion!