aboutsummaryrefslogtreecommitdiff
path: root/game/missile/AlertSubScene.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-10 14:50:50 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-10 14:50:50 +0100
commit7aa07561a52016007ff852acefa4db68260f0f1e (patch)
treeac438e906e581ee68f9d065dea90a2cbb8436d15 /game/missile/AlertSubScene.cpp
parentd7c8cc30e1d37526cf142f950038500b96760514 (diff)
parent0f8bf257d86b5532f3d6f559e5368668c255af7c (diff)
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/game-improvements
Diffstat (limited to 'game/missile/AlertSubScene.cpp')
-rw-r--r--game/missile/AlertSubScene.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/game/missile/AlertSubScene.cpp b/game/missile/AlertSubScene.cpp
new file mode 100644
index 0000000..5bce5ac
--- /dev/null
+++ b/game/missile/AlertSubScene.cpp
@@ -0,0 +1,33 @@
+#include "AlertSubScene.h"
+#include "../Config.h"
+
+#include <crepe/api/Animator.h>
+#include <crepe/api/Scene.h>
+#include <crepe/api/Sprite.h>
+
+using namespace crepe;
+
+MissileAlert::MissileAlert(Scene & scn) {
+ GameObject alert = scn.new_object("missile_alert", "missile_alert", {0, 0}, 0, 1);
+
+ Asset missile_alert_ss {"asset/obstacles/missile/missileAlert.png"};
+
+ auto & missile_alert_sprite = alert.add_component<Sprite>(
+ missile_alert_ss,
+ Sprite::Data {
+ .sorting_in_layer = SORT_IN_LAY_OBSTACLES,
+ .size = {0, 100},
+ }
+ );
+
+ auto & missile_alert_anim = alert.add_component<Animator>(
+ missile_alert_sprite, ivec2 {64, 64}, uvec2 {4, 2},
+ Animator::Data {
+ .fps = 15,
+ .looping = true,
+ }
+ );
+
+ missile_alert_anim.set_anim(1);
+ missile_alert_sprite.active = false;
+}