From d1235174157bd498d0c148325d7c8066e3ab6ac7 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 15 Feb 2021 12:05:18 -0500 Subject: Added camera shake to lightning event --- src/effect_system.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/effect_system.h') diff --git a/src/effect_system.h b/src/effect_system.h index 2cdcb10..12ec7ca 100644 --- a/src/effect_system.h +++ b/src/effect_system.h @@ -2,6 +2,8 @@ #define EFFECT_SYSTEM_H_0B497B39 #include "system.h" +#include "timer.h" +#include "vector.h" class Game; @@ -26,6 +28,12 @@ public: // - amount is [0,1] void fadeMap(int length, double amount); + // Shakes the viewport by 1 tile in both directions. + // - period is in milliseconds, it's actually a half period + void shakeCamera(int period); + + void stopShakingCamera(); + /* Information */ bool isScreenFaded() const { return screenFade_ > 0.0; } @@ -40,6 +48,10 @@ public: bool isMapFadeComplete() const { return mapFade_ == mapFadeDest_; } + const vec2i& getCameraShakeOffset() const { return cameraShakeOffset_; } + + bool isCameraShaking() const { return cameraShaking_; } + private: Game& game_; @@ -55,6 +67,11 @@ private: double mapFadeStart_ = 0.0; double mapFadeLength_ = 0.0; double mapFadeThus_ = 0.0; + + bool cameraShaking_ = false; + vec2i cameraShakeOffset_ { 0, 0 }; + bool cameraShakeOn_ = false; + Timer cameraShakeTimer_ { 0 }; }; #endif /* end of include guard: EFFECT_SYSTEM_H_0B497B39 */ -- cgit 1.4.1