diff options
-rw-r--r-- | src/crepe/system/RenderSystem.cpp | 2 | ||||
-rw-r--r-- | src/example/rendering_particle.cpp | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp index 3fbd175..8bbf441 100644 --- a/src/crepe/system/RenderSystem.cpp +++ b/src/crepe/system/RenderSystem.cpp @@ -51,6 +51,7 @@ void RenderSystem::render_particle(const ParticleEmitter& em, Transform & tm){ for (const Particle& p : em.data.particles) { if (!p.active) continue; tm.position = p.position; + tm.rotation = p.angle; render.draw(em.data.sprite, tm , *curr_cam); } } @@ -67,7 +68,6 @@ void RenderSystem::render_sprites() { auto transforms = mgr.get_components_by_id<Transform>(em.game_object_id); test.scale = transforms[0].get().scale; - test.rotation = transforms[0].get().rotation; this->render_particle(em, test); } } diff --git a/src/example/rendering_particle.cpp b/src/example/rendering_particle.cpp index bd4ceb4..dd08354 100644 --- a/src/example/rendering_particle.cpp +++ b/src/example/rendering_particle.cpp @@ -21,7 +21,7 @@ using namespace crepe; using namespace std; int main(int argc, char * argv[]) { - GameObject game_object(0, "", "", Vector2{100, 0}, 0, 0.1); + GameObject game_object(0, "", "", Vector2{100, 100}, 0, 0.1); Color color(0, 0, 0, 0); Sprite test_sprite = game_object.add_component<Sprite>( make_shared<Texture>("../asset/texture/img.png"), color, @@ -29,11 +29,11 @@ int main(int argc, char * argv[]) { game_object.add_component<ParticleEmitter>(ParticleEmitter::Data{ .position = {0, 0}, .max_particles = 10, - .emission_rate = 0.1, - .min_speed = 10, - .max_speed = 10, - .min_angle = 0, - .max_angle = 0, + .emission_rate = 0.5, + .min_speed = 6, + .max_speed = 20, + .min_angle = -20, + .max_angle = 20, .begin_lifespan = 0, .end_lifespan = 60, .force_over_time = Vector2{0, 0}, |