From: LMH Date: Sat, 29 Nov 2014 22:41:37 +0000 (-1000) Subject: Generated particles need not have any randomness in either angle or velocity. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cd21dc1adffb5f5edf5242ece50e4a55df2e5daf;p=supertux.git Generated particles need not have any randomness in either angle or velocity. --- diff --git a/src/object/fireworks.cpp b/src/object/fireworks.cpp index c557453f2..8ecbb0a1e 100644 --- a/src/object/fireworks.cpp +++ b/src/object/fireworks.cpp @@ -49,7 +49,7 @@ Fireworks::update(float ) //float green = 0.9; (void) red; (void) green; - sector->add_object(std::make_shared(pos, 0, 360, Vector(140, 140), + sector->add_object(std::make_shared(pos, 0, 360, 140, 140, Vector(0, 0), 45, Color(red, green, 0), 3, 1.3f, LAYER_FOREGROUND1+1)); SoundManager::current()->play("sounds/fireworks.wav"); diff --git a/src/object/particles.cpp b/src/object/particles.cpp index b468a931b..36d3b6ef8 100644 --- a/src/object/particles.cpp +++ b/src/object/particles.cpp @@ -88,8 +88,10 @@ Particles::Particles(const Vector& epicenter, int min_angle, int max_angle, Particle* particle = new Particle; particle->pos = epicenter; - float velocity = graphicsRandom.rand(min_initial_velocity, max_initial_velocity); - float angle = graphicsRandom.rand(min_angle, max_angle) * (M_PI / 180); // convert to radians + float velocity = (min_initial_velocity == max_initial_velocity) ? min_initial_velocity : + graphicsRandom.rand(min_initial_velocity, max_initial_velocity); + float angle = (min_angle == max_angle) ? min_angle * (M_PI / 180) : + graphicsRandom.rand(min_angle, max_angle) * (M_PI / 180); // convert to radians // Note that angle defined as clockwise from vertical (up is zero degrees, right is 90 degrees) particle->vel.x = (sin(angle)) * velocity; particle->vel.y = (-cos(angle)) * velocity;