aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorIndrajith K L2022-02-28 03:52:24 +0530
committerIndrajith K L2022-02-28 03:52:24 +0530
commit77f087952dda8cd3608f578877dab3c667fedabc (patch)
treecbe8505217275ff3b06c62602e6b61e38dbb036b /utils
parent48a80e29d52ded091d1f9425315957892f0070f7 (diff)
downloadYEAD-77f087952dda8cd3608f578877dab3c667fedabc.tar.gz
YEAD-77f087952dda8cd3608f578877dab3c667fedabc.tar.bz2
YEAD-77f087952dda8cd3608f578877dab3c667fedabc.zip
Adds Screen Shake on every 10 seconds
Diffstat (limited to 'utils')
-rw-r--r--utils/screen_shaker.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/screen_shaker.lua b/utils/screen_shaker.lua
new file mode 100644
index 0000000..ca996af
--- /dev/null
+++ b/utils/screen_shaker.lua
@@ -0,0 +1,26 @@
+Class = require("libs.hump.class")
+Shack = require("libs.shack")
+local Timer = require("libs.hump.Timer")
+
+ScreenShaker = Class {
+ init = function(self)
+ 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)
+end
+
+return ScreenShaker \ No newline at end of file