aboutsummaryrefslogtreecommitdiff
path: root/game/missile/AlertSubScene.cpp
blob: 5bce5ac5772d1ab06c495596c100951262aa2703 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}