mirror of
https://github.com/zoriya/ForecastingVillage.git
synced 2026-06-01 10:15:07 +00:00
adding a ccol particule effect on the player
This commit is contained in:
@@ -39,6 +39,6 @@
|
||||
<xp_component xp="20"/>
|
||||
<health_component max_health="25"/>
|
||||
<player_component fight_rate="5%" />
|
||||
<particule_component type="1" nb_particules_max="25" lifetime="120" />
|
||||
<particule_component type="1" nb_particules_max="15" lifetime="60" texture="stone" />
|
||||
</gc_entity>
|
||||
</gc_entities>
|
||||
|
||||
@@ -50,7 +50,7 @@ component;
|
||||
}
|
||||
cmp->type = xml_getintprop(n, "type");
|
||||
cmp->nb_max_particules = xml_getintprop(n, "nb_particules_max");
|
||||
cmp->texture = NULL;
|
||||
cmp->texture = scene->get_data(scene, "sprite", xml_getproperty(n, "texture"));
|
||||
cmp->lifetime = xml_getintprop(n, "lifetime");
|
||||
cmp->particules = malloc(sizeof(struct particule_component) * \
|
||||
(cmp->nb_max_particules + 1));
|
||||
|
||||
@@ -23,7 +23,7 @@ void *texture, gc_vector2 pos)
|
||||
particule->sprite->texture = texture;
|
||||
particule->sprite->pos = pos;
|
||||
particule->sprite->rect = (gc_int_rect){16, 16,0,0};
|
||||
particule->sprite->scale = (gc_vector2){1, 1};
|
||||
particule->sprite->scale = (gc_vector2){0.2, 0.2};
|
||||
}
|
||||
|
||||
void particule_draw(gc_engine *engine, void *system, \
|
||||
@@ -54,10 +54,11 @@ float dtime)
|
||||
|
||||
if (!ml || !tc || !cmp)
|
||||
return;
|
||||
//ml->tile->texture
|
||||
for (int i = 0; i < cmp->nb_max_particules; i++) {
|
||||
cmp->particules[i].lifetime -= (cmp->particules[i].lifetime) ? 1 : 0;
|
||||
if (!cmp->particules[i].lifetime) {
|
||||
create_particule(&cmp->particules[i], cmp->lifetime, ml->tile->texture, tc->position);
|
||||
create_particule(&cmp->particules[i], cmp->lifetime, cmp->texture, tc->position);
|
||||
}
|
||||
}
|
||||
particule_draw(engine, system, entity, dtime);
|
||||
|
||||
Reference in New Issue
Block a user