From f5eaa22a1c9598c9f7a55a41614d1ce4769dee4a Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Tue, 1 Mar 2022 02:48:49 +0530 Subject: * Adds Ambience SFX & Management * Notification - In-Progress * Collision Callbacks * Interactive & Pickable entities - In-Progress --- core/screen_shaker.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 core/screen_shaker.lua (limited to 'core/screen_shaker.lua') diff --git a/core/screen_shaker.lua b/core/screen_shaker.lua new file mode 100644 index 0000000..0316559 --- /dev/null +++ b/core/screen_shaker.lua @@ -0,0 +1,28 @@ +Class = require("libs.hump.class") +Shack = require("libs.shack") +local Timer = require("libs.hump.timer") + +ScreenShaker = Class { + init = function(self) + monsterGrowl = love.audio.newSource("assets/sfx/monster_growl.wav", "static") + local width, height = love.graphics.getDimensions() + Shack:setDimensions(width, height) + Timer.every(10, shakeScreen) + end +} + +function ScreenShaker:update(dt) + Timer.update(dt) + Shack:update(dt) +end + +function ScreenShaker:draw() + Shack:apply() +end + +function shakeScreen() + Shack:setShake(20) + monsterGrowl:play() +end + +return ScreenShaker \ No newline at end of file -- cgit v1.2.3