123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #include "explosions.h"
- #include "images_diffuse.h"
- #include "tag.h"
- declare_body(frame_killer, {
- size_t frames;
- })
- declare_tick(frame_killer, {
- if(--self->frames == 0) return 1;
- })
- declare_draw(frame_killer, { })
- declare_head(frame_killer)
- void kill_on_frame(entity *ent, size_t frame) {
- frame_killer *fk = c_new(frame_killer);
- fk->frames = frame;
- add_component(ent, fk);
- }
- entity *laser_explosion(vec pos) {
- entity *ent = ent_new();
- ent->position = vadd(pos, vxy(-4, -5));
- ent->tag = TAG_EXPLOSION;
-
- add_component(ent, get_animator(&sprite_laser_explode, 1));
- kill_on_frame(ent, 5);
-
- return ent;
- }
- entity *satellite_explosion(vec pos) {
- entity *ent = ent_new();
- ent->position = vadd(pos, vxy(-6, 0));
- ent->tag = TAG_EXPLOSION;
-
- add_component(ent, get_animator(&sprite_satellite_bullet_explode, 1));
- kill_on_frame(ent, 6);
-
- return ent;
- }
- entity *basic_spray_explosion(vec pos) {
- entity *ent = ent_new();
- ent->position = vadd(pos, vxy(-10, 0));
- ent->tag = TAG_EXPLOSION;
-
- add_component(ent, get_animator(&sprite_basic_spray_explode, 1));
- kill_on_frame(ent, 6);
-
- return ent;
- }
- entity *player_warp_animation() {
- entity *ent = ent_new();
- ent->tag = TAG_WARP;
-
- add_component(ent, get_animator(&sprite_player_ship_warp, 2));
- kill_on_frame(ent, 20 * 2);
-
- return ent;
- }
|