Correct use of camera shake

Hello all,

I’m working on my first Phaser project, and I’ve looked all over the internet but I can’t figure out what the correct way is to set up the camera shake.

My problem is that the game uses a shake animation every time an attack happens - so a lot of shakes. The first one is fine, but after that they get slower and choppier, and I can tell they must be piling up in memory somewhere, somehow.

I want to either know how to destroy the shake each time after it happens, OR have a single reusable shake object.

The command I’m using right now is:
this.cameras.main.shake(200, 0.02);

Can someone please either point me to an example, or share code that addresses this?

Thanks so much in advance!

It looks like the camera is supposed to prevent that, by the force argument (false, by default). But I haven’t tried it.

You can check this.cameras.main.shake.isRunning.