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
34
35
36
37
|
#include "SmokeSubScene.h"
#include "../Config.h"
#include <crepe/api/ParticleEmitter.h>
#include <crepe/api/Scene.h>
#include <crepe/api/Sprite.h>
using namespace crepe;
SmokeSubScene::SmokeSubScene(Scene & scn) {
GameObject smoke = scn.new_object("smoke_particle", "TAG", vec2 {500, -210}, 0, 1);
Asset smoke_ss {"asset/particles/smoke.png"};
auto & smoke_sprite = smoke.add_component<Sprite>(
smoke_ss,
Sprite::Data {
.sorting_in_layer = SORT_IN_LAY_PARTICLES_FOREGROUND,
.size = {0, 30},
}
);
smoke.add_component<ParticleEmitter>(
smoke_sprite,
ParticleEmitter::Data {
.offset = {0, -60},
.max_particles = 10,
.emission_rate = 25,
.min_angle = 60,
.max_angle = 120,
.begin_lifespan = 1,
.end_lifespan = 2,
}
);
}
|