diff options
author | Aki <please@ignore.pl> | 2022-04-25 02:02:11 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-25 02:02:11 +0200 |
commit | e51044a8872a05313fa92cad15eedf1f93f26aee (patch) | |
tree | aeb0eb6866a1ee5de3088e5b1d47f227c321b1ea /Flash.cpp | |
parent | 858a17930e29e38f236e8b60d0199489f9df0a48 (diff) | |
download | bullethell2022-e51044a8872a05313fa92cad15eedf1f93f26aee.zip bullethell2022-e51044a8872a05313fa92cad15eedf1f93f26aee.tar.gz bullethell2022-e51044a8872a05313fa92cad15eedf1f93f26aee.tar.bz2 |
Moved flash to own class and used it as transition to death screen
Diffstat (limited to 'Flash.cpp')
-rw-r--r-- | Flash.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Flash.cpp b/Flash.cpp new file mode 100644 index 0000000..ba9f836 --- /dev/null +++ b/Flash.cpp @@ -0,0 +1,37 @@ +#include "Flash.h" + +#include <raylib.h> + + +Flash::Flash() : + m_color {250, 190, 130, 255}, + m_duration {0.23}, + m_flash {0} +{ +} + + +void +Flash::update(const float dt) +{ + if (m_flash > 0) + m_flash -= dt; +} + + +void +Flash::draw() +{ + if (m_flash > 0) { + Color color = m_color; + color.a *= m_flash / m_duration; + DrawRectangle(0, 0, 800, 600, color); + } +} + + +void +Flash::start() +{ + m_flash = m_duration; +} |