Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
EntityBuilder.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Air-Trap, Client
4** File description:
5**
6 * EnemyBuilder
7*/
8
9#pragma once
10
16#include "RType/ECS/Entity.hpp"
18#include "RType/Error.hpp"
19#include "RType/Math/Vec2.hpp"
20
21#include <expected>
22#include <string>
23
24namespace rtp::client
25{
26
33 std::string id;
34 std::string tag{};
36 Vec2f position{0.0f, 0.0f};
37 float rotation{0.0f};
38 Vec2f scale{1.0f, 1.0f};
40 bool withVelocity{false};
46 false};
51 false};
55 // Generic sprite + optional animation definition
57 const char *id;
58 const char *texturePath;
63 int zIndex;
64 int red;
65 int green;
66 int blue;
73 float speed;
75 Vec2f scale{1.0f, 1.0f};
76 };
77
78 // Parallax layer definition
79 struct ParallaxDef {
80 const char *texturePath;
86 rtp::Vec2f scale{2.0f, 2.0f};
87 int rectWidth{1280};
88 int rectHeight{720};
89 };
90
91 // Helper: build an EntityTemplate from a SpriteAnimDef
92 static EntityTemplate makeFromDef(const Vec2f &initialPos,
93 const SpriteAnimDef &d)
94 {
96 t.id = d.id;
97 t.position = initialPos;
98 t.rotation = 0.0f;
99 t.scale = d.scale;
100
101 t.withVelocity = true;
102 t.velocity.speed = d.speed;
104
107 t.sprite.rectTop = d.rectTop;
110 t.sprite.zIndex = d.zIndex;
111 t.sprite.red = d.red;
112 t.sprite.green = d.green;
113 t.sprite.blue = d.blue;
114
116 if (d.withAnimation) {
122 }
123 return t;
124 }
125
126 // Helper: build an EntityTemplate for a parallax layer
128 {
130 t.id = "parallax_layer";
131 t.position = {0.0f, 0.0f};
132 t.rotation = 0.0f;
133 t.scale = p.scale;
134
135 t.withVelocity = true;
138
140 t.sprite.rectLeft = 0;
141 t.sprite.rectTop = 0;
144 t.sprite.zIndex = -1000;
145 t.sprite.red = 255;
146 t.sprite.opacity = p.opacity;
147
148 t.withParallax = true;
151 return t;
152 }
153
154 // Data tables
155 static constexpr ParallaxDef kParallaxLvl1_1{ "assets/backgrounds/lvl1/stars_far.png", 10.0f, {-50.0f, 0.0f}, 200, 100.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
156 static constexpr ParallaxDef kParallaxLvl1_2{ "assets/backgrounds/lvl1/stars_near.png", 20.0f, {-50.0f, 0.0f}, 255, 300.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
157 static constexpr ParallaxDef kParallaxLvl2_1{ "assets/backgrounds/lvl2/moon_back.png", 10.0f, {0.0f, 0.0f}, 200, 80.0f, 1200.0f, {1.0f, 1.0f}, 1300, 720 };
158 static constexpr ParallaxDef kParallaxLvl2_2{ "assets/backgrounds/lvl2/moon_earth.png", 25.0f, {-30.0f, 0.0f}, 255, 150.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
159 static constexpr ParallaxDef kParallaxLvl2_3{ "assets/backgrounds/lvl2/moon_floor.png", 12.0f, {-20.0f, 0.0f}, 200, 60.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
160 static constexpr ParallaxDef kParallaxLvl2_4{ "assets/backgrounds/lvl2/moon_front.png", 18.0f, {-40.0f, 0.0f}, 200, 90.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
161 static constexpr ParallaxDef kParallaxLvl2_5{ "assets/backgrounds/lvl2/moon_mid.png", 20.0f, {-25.0f, 0.0f}, 255, 70.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
162 static constexpr ParallaxDef kParallaxLvl2_6{ "assets/backgrounds/lvl2/moon_sky.png", 10.0f, {-15.0f, 0.0f}, 200, 50.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
163 static constexpr ParallaxDef kParallaxLvl3_1{ "assets/backgrounds/lvl3/Sky_back_mountain.png", 15.0f, {-20.0f, 0.0f}, 255, 60.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
164 static constexpr ParallaxDef kParallaxLvl3_2{ "assets/backgrounds/lvl3/sky_cloud_floor_2.png", 22.0f, {-35.0f, 0.0f}, 200, 85.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
165 static constexpr ParallaxDef kParallaxLvl3_3{ "assets/backgrounds/lvl3/sky_cloud_floor.png", 18.0f, {-25.0f, 0.0f}, 255, 70.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
166 static constexpr ParallaxDef kParallaxLvl3_4{ "assets/backgrounds/lvl3/Sky_cloud_single.png", 20.0f, {-30.0f, 0.0f}, 255, 90.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
167 static constexpr ParallaxDef kParallaxLvl3_5{ "assets/backgrounds/lvl3/sky_clouds.png", 12.0f, {-15.0f, 0.0f}, 200, 55.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
168 static constexpr ParallaxDef kParallaxLvl3_6{ "assets/backgrounds/lvl3/Sky_front_cloud.png", 12.0f, {-15.0f, 0.0f}, 200, 55.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
169 static constexpr ParallaxDef kParallaxLvl3_7{ "assets/backgrounds/lvl3/sky_front_mountain.png", 12.0f, {-15.0f, 0.0f}, 200, 55.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
170 static constexpr ParallaxDef kParallaxLvl3_8{ "assets/backgrounds/lvl3/sky_moon.png", 12.0f, {-15.0f, 0.0f}, 200, 55.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
171 static constexpr ParallaxDef kParallaxLvl3_9{ "assets/backgrounds/lvl3/Sky_sky.png", 12.0f, {-15.0f, 0.0f}, 200, 55.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
172 static constexpr ParallaxDef kParallaxLvl4_1{ "assets/backgrounds/lvl4/desert_cloud.png", 15.0f, {-30.0f, 0.0f}, 200, 80.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
173 static constexpr ParallaxDef kParallaxLvl4_2{ "assets/backgrounds/lvl4/desert_dunefrontt.png", 25.0f, {-30.0f, 0.0f}, 255, 150.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
174 static constexpr ParallaxDef kParallaxLvl4_3{ "assets/backgrounds/lvl4/desert_dunemid.png", 12.0f, {-20.0f, 0.0f}, 200, 60.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
175 static constexpr ParallaxDef kParallaxLvl4_4{ "assets/backgrounds/lvl4/desert_moon.png", 18.0f, {-40.0f, 0.0f}, 200, 90.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
176 static constexpr ParallaxDef kParallaxLvl4_5{ "assets/backgrounds/lvl4/desert_mountain.png", 20.0f, {-25.0f, 0.0f}, 255, 70.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
177 static constexpr ParallaxDef kParallaxLvl4_6{ "assets/backgrounds/lvl4/desert_sky.png", 10.0f, {-15.0f, 0.0f}, 200, 50.0f, 1280.0f, {2.0f, 2.0f}, 1280, 720 };
178
179 static constexpr SpriteAnimDef k_rt1_1{
180 "player_ship", "assets/sprites/r-typesheet1.gif",
181 101, 3,
182 33, 14,
183 5, 255, 255, 255, // RGB tint (white by default)
184 true, 33,
185 14, 101,
186 3, 5,
187 2.0f, {-1.0f, 0.0f},
188 {1.0f, 1.0f}
189 };
190 static constexpr SpriteAnimDef k_rt1_2{
191 "shot_insane", "assets/sprites/r-typesheet1.gif",
192 134, 18,
193 33, 32,
194 5, 255, 255, 255, // RGB tint (white by default)
195 true, 33,
196 32, 134,
197 18, 4,
198 2.0f, {-1.0f, 0.0f},
199 {1.0f, 1.0f}
200 };
201 static constexpr SpriteAnimDef k_rt1_3{
202 "effect_1", "assets/sprites/r-typesheet1.gif",
203 2, 51,
204 33, 32,
205 5, 255, 255, 255, // RGB tint (white by default)
206 true, 33,
207 32, 2,
208 51, 8,
209 2.0f, {-1.0f, 0.0f},
210 {1.0f, 1.0f}
211 };
212 static constexpr SpriteAnimDef k_rt1_4{
213 "shot_1", "assets/sprites/r-typesheet1.gif",
214 215, 85,
215 18, 12,
216 5, 255, 255, 255, // RGB tint (white by default)
217 true, 18,
218 12, 215,
219 85, 3,
220 2.0f, {-1.0f, 0.0f},
221 {1.0f, 1.0f}
222 };
223 static constexpr SpriteAnimDef k_rt1_5{
224 "shot_2", "assets/sprites/r-typesheet1.gif",
225 232, 103,
226 17, 12,
227 5, 255, 255, 255, // RGB tint (white by default)
228 true, 17,
229 12, 232,
230 103, 2,
231 2.0f, {-1.0f, 0.0f},
232 {1.0f, 1.0f}
233 };
234 static constexpr SpriteAnimDef k_rt1_6{
235 "shot_3", "assets/sprites/r-typesheet1.gif",
236 200, 121,
237 33, 10,
238 5, 255, 255, 255, // RGB tint (white by default)
239 true, 33,
240 10, 200,
241 121, 2,
242 2.0f, {-1.0f, 0.0f},
243 {1.0f, 1.0f}
244 };
245 static constexpr SpriteAnimDef k_rt1_7{
246 "shot_4", "assets/sprites/r-typesheet1.gif",
247 168, 137,
248 49, 12,
249 5, 255, 255, 255, // RGB tint (white by default)
250 true, 49,
251 12, 168,
252 137, 2,
253 2.0f, {-1.0f, 0.0f},
254 {1.0f, 1.0f}
255 };
256 static constexpr SpriteAnimDef k_rt1_8{
257 "shot_5", "assets/sprites/r-typesheet1.gif",
258 104, 171,
259 81, 14,
260 5, 255, 255, 255, // RGB tint (white by default)
261 true, 81,
262 14, 104,
263 171, 2,
264 2.0f, {-1.0f, 0.0f},
265 {1.0f, 1.0f}
266 };
267 static constexpr SpriteAnimDef k_rt1_12{
268 "effect_2", "assets/sprites/r-typesheet1.gif",
269 211, 276,
270 16, 12,
271 5, 255, 255, 255, // RGB tint (white by default)
272 true, 16,
273 12, 211,
274 276, 4,
275 2.0f, {-1.0f, 0.0f},
276 {1.0f, 1.0f}
277 };
278 static constexpr SpriteAnimDef k_rt1_13{
279 "effect_3", "assets/sprites/r-typesheet1.gif",
280 72, 296,
281 37, 30,
282 5, 255, 255, 255, // RGB tint (white by default)
283 true, 37,
284 30, 72,
285 296, 6,
286 2.0f, {-1.0f, 0.0f},
287 {1.0f, 1.0f}
288 };
289
290 static constexpr SpriteAnimDef k_rt2_2{
291 "enemy_1", "assets/sprites/r-typesheet2.gif",
292 159, 35,
293 24, 16,
294 5, 255, 255, 255, // RGB tint (white by default)
295 true, 24,
296 16, 159,
297 35, 6,
298 2.0f, {-1.0f, 0.0f},
299 {1.0f, 1.0f}
300 };
301 static constexpr SpriteAnimDef k_rt2_3{
302 "shot_6", "assets/sprites/r-typesheet2.gif",
303 300, 58,
304 18, 6,
305 5, 255, 255, 255, // RGB tint (white by default)
306 false, 0,
307 0, 0,
308 0, 0,
309 50.0f, {-1.0f, 0.0f},
310 {1.0f, 1.0f}
311 };
312 static constexpr SpriteAnimDef k_rt2_4{
313 "enemy_2", "assets/sprites/r-typesheet2.gif",
314 300, 71,
315 30, 18,
316 5, 255, 255, 255, // RGB tint (white by default)
317 true, 30,
318 18, 300,
319 71, 6,
320 2.0f, {-1.0f, 0.0f},
321 {1.0f, 1.0f}
322 };
323 static constexpr SpriteAnimDef k_rt2_5{
324 "shot_7", "assets/sprites/r-typesheet2.gif",
325 266, 94,
326 17, 10,
327 5, 255, 255, 255, // RGB tint (white by default)
328 true, 17,
329 10, 266,
330 94, 2,
331 2.0f, {-1.0f, 0.0f},
332 {1.0f, 1.0f}
333 };
334 static constexpr SpriteAnimDef k_rt2_6{
335 "effect_4", "assets/sprites/r-typesheet2.gif",
336 101, 118,
337 17, 14,
338 5, 255, 255, 255, // RGB tint (white by default)
339 true, 17,
340 14, 101,
341 118, 4,
342 2.0f, {-1.0f, 0.0f},
343 {1.0f, 1.0f}
344 };
345 static constexpr SpriteAnimDef k_rt2_7{
346 "effect_5", "assets/sprites/r-typesheet2.gif",
347 157, 316,
348 18, 14,
349 5, 255, 255, 255, // RGB tint (white by default)
350 true, 18,
351 14, 157,
352 316, 8,
353 2.0f, {-1.0f, 0.0f},
354 {1.0f, 1.0f}
355 };
356 static constexpr SpriteAnimDef k_rt3_1{
357 "power_up_heal", "assets/sprites/r-typesheet3.gif",
358 0, 0, // Red powerup (Heal) - frame 0
359 16, 16, // Each frame is 16x16
360 5, 255, 255, 100, // zIndex 5, RED tint (R=255, G=255, B=100)
361 true, 16, // withAnimation, frameWidth 16
362 16, 0, // frameHeight 16, frameLeft 0
363 0, 12, // frameTop 0, totalFrames 12
364 2.0f, {0.0f, 0.0f}, // speed 2.0, no movement
365 {2.0f, 2.0f} // scale 2x for visibility
366 };
367 static constexpr SpriteAnimDef k_rt3_2{
368 "power_up_double", "assets/sprites/r-typesheet3.gif",
369 64, 0, // Cyan powerup (DoubleFire) - frame 4 (16*4=64)
370 16, 16, // Each frame is 16x16
371 5, 100, 200, 255, // zIndex 5, CYAN tint (R=100, G=200, B=255)
372 true, 16, // withAnimation, frameWidth 16
373 16, 64, // frameHeight 16, frameLeft 64
374 0, 12, // frameTop 0, totalFrames 12
375 2.0f, {0.0f, 0.0f}, // speed 2.0, no movement
376 {2.0f, 2.0f} // scale 2x for visibility
377 };
378 static constexpr SpriteAnimDef k_rt3_3{
379 "power_up_shield", "assets/sprites/r-typesheet3.gif",
380 128, 0, // Green powerup (Shield) - frame 8 (16*8=128)
381 16, 16, // Each frame is 16x16
382 5, 100, 255, 100, // zIndex 5, GREEN tint (R=100, G=255, B=100)
383 true, 16, // withAnimation, frameWidth 16
384 16, 128, // frameHeight 16, frameLeft 128
385 0, 12, // frameTop 0, totalFrames 12
386 2.0f, {0.0f, 0.0f}, // speed 2.0, no movement
387 {2.0f, 2.0f} // scale 2x for visibility
388 };
389 static constexpr SpriteAnimDef k_rt39_1{
390 "boss_ship", "assets/sprites/r-typesheet39.gif",
391 33, 1,
392 66, 66,
393 5, 255, 255, 255, // RGB tint (white by default)
394 false, 66,
395 33, 66,
396 1, 0,
397 1.0f, {-1.0f, 0.0f},
398 {3.0f, 3.0f}
399 };
400 static constexpr SpriteAnimDef k_rt39_2{
401 "boss_shield", "assets/sprites/r-typesheet39.gif",
402 0, 72,
403 30, 33,
404 5, 255, 255, 255, // RGB tint (white by default)
405 true, 33,
406 30, 0,
407 72, 4,
408 1.0f, {-1.0f, 0.0f},
409 {3.0f, 3.0f}
410 };
411 // Kraken Alien Boss (r-typesheet35.gif) - 528x574 spritesheet, 2 cols x 4 rows = 8 frames
412 // Each frame: 264x143 (approx)
413 static constexpr SpriteAnimDef k_rt35_boss2{
414 "boss2_kraken", "assets/sprites/r-typesheet35.gif",
415 0, 0,
416 264, 143,
417 5, 255, 200, 200, // Slight red tint for menacing look
418 true, 264,
419 143, 0,
420 0, 8,
421 0.5f, {-1.0f, 0.0f},
422 {1.5f, 1.5f} // Large scale for intimidating boss
423 };
424 // Kraken Boomerang projectile (uses a menacing tentacle-like look)
426 "boss2_bullet", "assets/sprites/r-typesheet1.gif",
427 215, 85,
428 18, 12,
429 5, 255, 100, 100, // Red tint for enemy projectile
430 true, 18,
431 12, 215,
432 85, 3,
433 5.0f, {-1.0f, 0.0f},
434 {2.0f, 2.0f}
435 };
436
441
446
451
456
461
466
471
476
481
486
491
496
501
506
511
516
521
526
531
536
541
546
551
552 static EntityTemplate player_ship(const Vec2f &initialPos)
553 {
554 return makeFromDef(initialPos, k_rt1_1);
555 }
556
557 static EntityTemplate shot_insane(const Vec2f &initialPos)
558 {
559 return makeFromDef(initialPos, k_rt1_2);
560 }
561
562 static EntityTemplate effect_1(const Vec2f &initialPos)
563 {
564 return makeFromDef(initialPos, k_rt1_3);
565 }
566
567 static EntityTemplate shot_1(const Vec2f &initialPos)
568 {
569 return makeFromDef(initialPos, k_rt1_4);
570 }
571
572 static EntityTemplate shot_2(const Vec2f &initialPos)
573 {
574 return makeFromDef(initialPos, k_rt1_5);
575 }
576
577 static EntityTemplate shot_3(const Vec2f &initialPos)
578 {
579 return makeFromDef(initialPos, k_rt1_6);
580 }
581
582 static EntityTemplate shot_4(const Vec2f &initialPos)
583 {
584 return makeFromDef(initialPos, k_rt1_7);
585 }
586
587 static EntityTemplate shot_5(const Vec2f &initialPos)
588 {
589 auto t = makeFromDef(initialPos, k_rt1_8);
590 // Default shot_5 sprites point left; flip horizontally so tip faces right
591 t.scale.x = -std::abs(t.scale.x);
592 return t;
593 }
594
595 static EntityTemplate effect_2(const Vec2f &initialPos)
596 {
597 return makeFromDef(initialPos, k_rt1_12);
598 }
599
600 static EntityTemplate effect_3(const Vec2f &initialPos)
601 {
602 return makeFromDef(initialPos, k_rt1_13);
603 }
604
605 static EntityTemplate enemy_1(const Vec2f &initialPos)
606 {
607 return makeFromDef(initialPos, k_rt2_2);
608 }
609
610 static EntityTemplate shot_6(const Vec2f &initialPos)
611 {
612 return makeFromDef(initialPos, k_rt2_3);
613 }
614
615 static EntityTemplate enemy_2(const Vec2f &initialPos)
616 {
617 return makeFromDef(initialPos, k_rt2_4);
618 }
619
620 static EntityTemplate shot_7(const Vec2f &initialPos)
621 {
622 return makeFromDef(initialPos, k_rt2_5);
623 }
624
625 static EntityTemplate effect_4(const Vec2f &initialPos)
626 {
627 return makeFromDef(initialPos, k_rt2_6);
628 }
629
630 static EntityTemplate effect_5(const Vec2f &initialPos)
631 {
632 return makeFromDef(initialPos, k_rt2_7);
633 }
634
635 // Convenience aliases used by Application.cpp
636 static EntityTemplate createBulletPlayer(const Vec2f &initialPos)
637 {
638 auto t = makeFromDef(initialPos, k_rt2_3);
639 t.tag = "player_bullet";
640 return t;
641 }
642
643 static EntityTemplate createBulletEnemy(const Vec2f &initialPos)
644 {
645 auto t = makeFromDef(initialPos, k_rt2_3);
646 t.tag = "enemy_bullet";
647 return t;
648 }
649
650 static EntityTemplate createBasicScout2(const Vec2f &initialPos)
651 {
652 return makeFromDef(initialPos, k_rt2_2);
653 }
654
655 static EntityTemplate createPowerUpHeal(const Vec2f &initialPos)
656 {
657 return makeFromDef(initialPos, k_rt3_1);
658 }
659
661 {
662 return makeFromDef(initialPos, k_rt3_2);
663 }
664
665 static EntityTemplate createPowerUpShield(const Vec2f &initialPos)
666 {
667 return makeFromDef(initialPos, k_rt3_3);
668 }
669
670 static EntityTemplate createBossShip(const Vec2f &initialPos)
671 {
672 return makeFromDef(initialPos, k_rt39_1);
673 }
674
675 static EntityTemplate createBossShield(const Vec2f &initialPos)
676 {
677 return makeFromDef(initialPos, k_rt39_2);
678 }
679
680 static EntityTemplate createBoss2Kraken(const Vec2f &initialPos)
681 {
682 auto t = makeFromDef(initialPos, k_rt35_boss2);
683 t.tag = "boss2_kraken";
684 return t;
685 }
686
687 static EntityTemplate createBoss2Bullet(const Vec2f &initialPos)
688 {
689 auto t = makeFromDef(initialPos, k_rt35_boss2_bullet);
690 t.tag = "boss2_bullet";
691 return t;
692 }
693 };
694
701 public:
702 explicit EntityBuilder(ecs::Registry &registry);
703
704 [[nodiscard]]
705 auto spawn(const EntityTemplate &t)
706 -> std::expected<ecs::Entity, Error>;
707
708 void kill(ecs::Entity entity);
709
710 void update(ecs::Entity entity, const EntityTemplate &t);
711
712 private:
714 };
715
716}
Entity identifier for ECS architecture.
Error handling system with categorized error codes.
Declaration of the 2-dimensional vector class.
void update(ecs::Entity entity, const EntityTemplate &t)
void kill(ecs::Entity entity)
auto spawn(const EntityTemplate &t) -> std::expected< ecs::Entity, Error >
Represents an entity in the ECS (Entity-Component-System) architecture.
Definition Entity.hpp:63
R-Type client namespace.
ecs::components::Velocity velocity
Initial velocity.
static constexpr SpriteAnimDef k_rt1_4
static EntityTemplate createParallaxLvl3_1()
static EntityTemplate createParallaxLvl3_9()
static constexpr ParallaxDef kParallaxLvl4_1
static constexpr ParallaxDef kParallaxLvl4_6
static constexpr ParallaxDef kParallaxLvl3_4
static EntityTemplate createParallaxLvl2_5()
static EntityTemplate createBoss2Bullet(const Vec2f &initialPos)
static EntityTemplate createBoss2Kraken(const Vec2f &initialPos)
static constexpr SpriteAnimDef k_rt3_2
static constexpr ParallaxDef kParallaxLvl1_2
static constexpr ParallaxDef kParallaxLvl2_5
static constexpr SpriteAnimDef k_rt3_1
static EntityTemplate createParallaxLvl4_3()
static EntityTemplate createParallaxLvl3_8()
Vec2f position
Spawn position.
static EntityTemplate player_ship(const Vec2f &initialPos)
static constexpr ParallaxDef kParallaxLvl4_2
static EntityTemplate createParallaxLvl3_4()
static constexpr SpriteAnimDef k_rt39_2
static EntityTemplate createBasicScout2(const Vec2f &initialPos)
static EntityTemplate createParallaxLvl3_3()
static constexpr ParallaxDef kParallaxLvl2_2
static EntityTemplate createBossShip(const Vec2f &initialPos)
static constexpr ParallaxDef kParallaxLvl1_1
static EntityTemplate makeParallax(const ParallaxDef &p)
static constexpr SpriteAnimDef k_rt35_boss2_bullet
ecs::components::Animation animation
Initial animation data.
static EntityTemplate createParallaxLvl4_4()
std::string tag
Template tag for entity differentiation.
static constexpr ParallaxDef kParallaxLvl4_3
static EntityTemplate createBossShield(const Vec2f &initialPos)
static EntityTemplate effect_4(const Vec2f &initialPos)
bool withAnimation
Whether to add Animation component.
static constexpr SpriteAnimDef k_rt2_4
static constexpr SpriteAnimDef k_rt39_1
static EntityTemplate effect_1(const Vec2f &initialPos)
static EntityTemplate createBulletEnemy(const Vec2f &initialPos)
static EntityTemplate shot_2(const Vec2f &initialPos)
static constexpr SpriteAnimDef k_rt2_6
static constexpr ParallaxDef kParallaxLvl2_3
static constexpr ParallaxDef kParallaxLvl2_6
float rotation
Spawn rotation.
static constexpr ParallaxDef kParallaxLvl3_6
static EntityTemplate createParallaxLvl3_2()
static constexpr ParallaxDef kParallaxLvl3_8
static constexpr SpriteAnimDef k_rt35_boss2
static constexpr SpriteAnimDef k_rt2_5
bool withVelocity
Whether to add Velocity component.
static EntityTemplate createParallaxLvl3_5()
static EntityTemplate createParallaxLvl2_1()
static EntityTemplate createParrallaxLvl1_2()
static EntityTemplate createParallaxLvl4_5()
static constexpr SpriteAnimDef k_rt1_1
bool withParallax
Whether to add ParallaxLayer component.
static EntityTemplate effect_5(const Vec2f &initialPos)
static constexpr SpriteAnimDef k_rt1_2
static EntityTemplate shot_6(const Vec2f &initialPos)
static EntityTemplate createParallaxLvl2_6()
static EntityTemplate createParrallaxLvl1_1()
static constexpr SpriteAnimDef k_rt2_3
static constexpr SpriteAnimDef k_rt1_8
static constexpr SpriteAnimDef k_rt2_2
static EntityTemplate createParallaxLvl3_7()
static constexpr SpriteAnimDef k_rt2_7
static EntityTemplate createPowerUpDoubleFire(const Vec2f &initialPos)
static EntityTemplate createParallaxLvl4_1()
static EntityTemplate createBulletPlayer(const Vec2f &initialPos)
static EntityTemplate createParallaxLvl2_4()
static EntityTemplate effect_3(const Vec2f &initialPos)
static constexpr ParallaxDef kParallaxLvl4_5
static EntityTemplate shot_7(const Vec2f &initialPos)
static EntityTemplate createParallaxLvl4_2()
static constexpr SpriteAnimDef k_rt1_3
static EntityTemplate shot_3(const Vec2f &initialPos)
static constexpr ParallaxDef kParallaxLvl3_9
static constexpr SpriteAnimDef k_rt1_5
static constexpr ParallaxDef kParallaxLvl3_5
static EntityTemplate makeFromDef(const Vec2f &initialPos, const SpriteAnimDef &d)
static constexpr ParallaxDef kParallaxLvl3_7
static EntityTemplate shot_5(const Vec2f &initialPos)
static EntityTemplate createParallaxLvl2_2()
static constexpr ParallaxDef kParallaxLvl3_3
static constexpr ParallaxDef kParallaxLvl2_4
static EntityTemplate enemy_2(const Vec2f &initialPos)
static EntityTemplate createParallaxLvl4_6()
static EntityTemplate enemy_1(const Vec2f &initialPos)
static constexpr SpriteAnimDef k_rt1_12
static EntityTemplate createParallaxLvl3_6()
static constexpr ParallaxDef kParallaxLvl4_4
static EntityTemplate createParallaxLvl2_3()
static EntityTemplate createPowerUpShield(const Vec2f &initialPos)
static EntityTemplate shot_4(const Vec2f &initialPos)
static EntityTemplate createPowerUpHeal(const Vec2f &initialPos)
static EntityTemplate shot_1(const Vec2f &initialPos)
static constexpr SpriteAnimDef k_rt1_6
static constexpr SpriteAnimDef k_rt1_13
ecs::components::ParallaxLayer parallax
Parallax layer data.
ecs::components::Sprite sprite
Sprite data.
std::string id
Enemy type identifier.
static constexpr ParallaxDef kParallaxLvl2_1
static EntityTemplate effect_2(const Vec2f &initialPos)
static constexpr SpriteAnimDef k_rt3_3
static constexpr ParallaxDef kParallaxLvl3_2
static constexpr SpriteAnimDef k_rt1_7
static EntityTemplate shot_insane(const Vec2f &initialPos)
static constexpr ParallaxDef kParallaxLvl3_1
Component representing an animation.
Definition Animation.hpp:17
int frameWidth
Width of the current frame.
Definition Animation.hpp:25
int frameHeight
Height of the current frame.
Definition Animation.hpp:26
int frameTop
Top position of the current frame.
Definition Animation.hpp:24
int totalFrames
Total frames including all animations.
Definition Animation.hpp:18
int frameLeft
Left position of the current frame.
Definition Animation.hpp:23
Tag component indicating that an entity should loop its position when it exits the screen (infinite s...
float textureWidth
Width of the texture used for parallax scrolling.
float speed
Scrolling speed of the parallax layer.
Component representing a sprite.
Definition Sprite.hpp:21
std::string texturePath
Identifier for the texture resource.
Definition Sprite.hpp:22
std::uint8_t blue
Blue color component.
Definition Sprite.hpp:34
int rectLeft
Left position of the texture rectangle.
Definition Sprite.hpp:24
int rectHeight
Height of the texture rectangle.
Definition Sprite.hpp:27
std::uint8_t red
Red color component.
Definition Sprite.hpp:32
std::uint8_t opacity
Opacity of the sprite (0-255)
Definition Sprite.hpp:31
std::uint8_t green
Green color component.
Definition Sprite.hpp:33
int rectTop
Top position of the texture rectangle.
Definition Sprite.hpp:25
int zIndex
Z-index for rendering order.
Definition Sprite.hpp:29
int rectWidth
Width of the texture rectangle.
Definition Sprite.hpp:26
Component representing a 2D velocity.
Definition Velocity.hpp:17
float speed
Speed multiplier.
Definition Velocity.hpp:19
Vec2f direction
Velocity in X and Y directions.
Definition Velocity.hpp:18