The plugin for Phaser HTML5 game framework to add screen shake fx
You can see it in action here. Just let the player die or jumping up on an enemy.
In your create method, add the plugin to the game:
game.plugins.screenShake = game.plugins.add(Phaser.Plugin.ScreenShake);
in function where need to call shake FX:
if need to replace default plugin settings
game.plugins.screenShake.setup({
shakeX: true,
shakeY: false
});
And pass shake count value:
game.plugins.screenShake.shake(10);
- shakesCount: [number] - count of short camera movements
- shakeX: [bool] - shake the screen by x
- shakeY: [bool] true - shake the screen by y
- sensCoef: [number/float] - shake sensitivity coefficient
The MIT License (MIT)