Skip to content

Commit

Permalink
render particle when other players move as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes committed May 5, 2024
1 parent 2661168 commit d51f419
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,51 @@ void engine_draw_first_pass(Engine* engine, GameData* data)
Vector2 player_position = data->player_entity_infos[i].position;
Entity entity = {0};
entity.position = player_position;
entity.state = data->player_entity_infos[i].state;
entity.texture = data->player.texture;
entity.UV_texture = data->player.UV_texture;
draw_entity(&entity, engine->uv_shader, data->camera_offset);

Particle particle;
Vector3 velocity = Vector3Zero();
Vector3 position = { .x = entity.position.x, .y = entity.position.y, .z = 0 };
switch (entity.state)
{
case MOVE_UP:
velocity.z = -GRAVITY_CONST;

initialize_particle(&particle, 8, 8, 2, GREEN, velocity, position);
set_particle_types(&particle, FADING, SHRINKING, PARTICLE_NULL_TYPE);
add_particle(particle, data);
break;

case MOVE_DOWN:
velocity.z = GRAVITY_CONST;

initialize_particle(&particle, 8, 8, 2, GREEN, velocity, position);
set_particle_types(&particle, FADING, SHRINKING, PARTICLE_NULL_TYPE);
add_particle(particle, data);
break;

case MOVE_RIGHT:
velocity.x = GRAVITY_CONST;

initialize_particle(&particle, 8, 8, 2, GREEN, velocity, position);
set_particle_types(&particle, FADING, SHRINKING, PARTICLE_NULL_TYPE);
add_particle(particle, data);
break;

case MOVE_LEFT:
velocity.x = -GRAVITY_CONST;

initialize_particle(&particle, 8, 8, 2, GREEN, velocity, position);
set_particle_types(&particle, FADING, SHRINKING, PARTICLE_NULL_TYPE);
add_particle(particle, data);
break;
default:
break;
}

}
}

Expand Down

0 comments on commit d51f419

Please sign in to comment.