I have a bullet that has projectile motion, this bullet is also an effect. Also the bullet has a shadow, that fade on specific time relatively to bullet. So I'm thinking of using the libgdx particle system (I am using an Entity Component-based System approach) so I created a particle component, or would you rather recommend to create another component for that specific effect? like a projectile component and linear component or a motion component in general.
Creating shadow, bullet, and other single object effect entity. Notice that I doesn't use any Box2d Physics yet.
Entity shadow = engine.createEntity();
... add texture, transform, movement or with gravity components
engine.addEntity(shadow);
To move the shadow entity
// Shadow
Vector2 linear = ...
movement.velocity.set(linear);
To move the bullet entity
// Bullet
gravity.vertical = 9.8f; // set earth gravity
Vector2 projectile = ...
movement.velocity.set(projectile);
// Also I need to calculate the time to reach its destination to add in lifespan
To create and move a ball entity
Entity ball = ...
// assume that the world has zero horizontal and 9.8 vertical Vector2 gravity
// set the physics body and set restitution to have bounce
physics.body = createCircleBody(...);
add(texture);
add(transform);
add(physics);
Every single object has lifespan so I added some lifespan component
LifespanComponent lifespan = ...
lifespan.duration = 0.5f; // let say half a second
Then the lifespan system will handle if the time reached the duration, then remove entity.
The problem is, Because Particle System
has many moving objects, I don't know if I could use libgdx Particle System to create a single moving object that has a lifespan, like shadow, ball, bullet.
this bullet it also an effect
? and what's exactly not working for you? \$\endgroup\$