From 15a958a7f327bb2e81e7d445f1499ec78c7f5839 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Fri, 10 Jan 2025 12:05:16 +0100 Subject: alers scripts and quitscript with ESC key --- game/missile/AlertSubScene.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 game/missile/AlertSubScene.cpp (limited to 'game/missile/AlertSubScene.cpp') diff --git a/game/missile/AlertSubScene.cpp b/game/missile/AlertSubScene.cpp new file mode 100644 index 0000000..c3379e8 --- /dev/null +++ b/game/missile/AlertSubScene.cpp @@ -0,0 +1,38 @@ +#include "AlertSubScene.h" +#include "../Config.h" +#include "api/Animator.h" +#include "api/BehaviorScript.h" +#include "api/Scene.h" +#include "api/Sprite.h" +#include "missile/AlertScript.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"}; + + //alert.add_component().set_script(); + + auto & missile_alert_sprite = alert.add_component( + missile_alert_ss, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_OBSTACLES, + .size = {0, 100}, + } + ); + + auto & missile_alert_anim = alert.add_component( + 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; + + +} -- cgit v1.2.3