#include "components.h" #include "fx.h" #include "world.h" static int new_fx( World* world, int x, int y, Animation_ID anim ) { Entity e; CPosition* pos; CSprite* sprite; CAnimated* animated; e = new_entity(world); add_components( world, e, ctype_sprite | ctype_position | ctype_animated | ctype_destroy_on_anim_done ); pos = &world->positions[e]; sprite = &world->sprites[e]; animated = &world->animateds[e]; pos->x = x; pos->y = y; sprite->id = asset_id_bullet; sprite->rect = make_rect(0, 0, 16, 16); animated->id = anim; animated->frame = 0; animated->timer = 0; return e; } int new_enemy_bullet_explosion( World* world, int x, int y ) { return new_fx(world, x, y, animation_enemy_bullet_explode); } int new_player_bullet_explosion( World* world, int x, int y ) { return new_fx(world, x, y, animation_player_bullet_explode); }