From: LMH Date: Sat, 29 Nov 2014 22:31:48 +0000 (-1000) Subject: Explicitly defined the angle used by Particles, used new definition for particles... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b09b702acea75965b0192474b813b40195d4d8de;p=supertux.git Explicitly defined the angle used by Particles, used new definition for particles generated by skid and buttjump. --- diff --git a/src/object/particles.cpp b/src/object/particles.cpp index 1babe233c..b468a931b 100644 --- a/src/object/particles.cpp +++ b/src/object/particles.cpp @@ -90,8 +90,9 @@ Particles::Particles(const Vector& epicenter, int min_angle, int max_angle, float velocity = graphicsRandom.rand(min_initial_velocity, max_initial_velocity); float angle = graphicsRandom.rand(min_angle, max_angle) * (M_PI / 180); // convert to radians - particle->vel.x = (cos(angle)) * velocity; - particle->vel.y = (-sin(angle)) * velocity; + // 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; particles.push_back(particle); } diff --git a/src/object/player.cpp b/src/object/player.cpp index ef5b489da..5f38c7fc8 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -570,10 +570,9 @@ Player::handle_horizontal_input() // dust some particles Sector::current()->add_object( std::make_shared( - Vector(dir == RIGHT ? get_bbox().p2.x : get_bbox().p1.x, get_bbox().p2.y), - dir == RIGHT ? 270+20 : 90-40, dir == RIGHT ? 270+40 : 90-20, - Vector(280, -260), Vector(0, 300), 3, Color(.4f, .4f, .4f), 3, .8f, - LAYER_OBJECTS+1)); + Vector(dir == LEFT ? get_bbox().p2.x : get_bbox().p1.x, get_bbox().p2.y), + dir == LEFT ? 50 : -70, dir == LEFT ? 70 : -50, 260, 280, + Vector(0, 300), 3, Color(.4f, .4f, .4f), 3, .8f, LAYER_OBJECTS+1)); ax *= 2.5; } else { @@ -1342,14 +1341,12 @@ Player::collision_solid(const CollisionHit& hit) on_ground_flag = false; Sector::current()->add_object(std::make_shared( Vector(get_bbox().p2.x, get_bbox().p2.y), - 270+20, 270+40, - Vector(280, -260), Vector(0, 300), 3, Color(.4f, .4f, .4f), 3, .8f, - LAYER_OBJECTS+1)); + 50, 70, 260, 280, Vector(0, 300), 3, + Color(.4f, .4f, .4f), 3, .8f, LAYER_OBJECTS+1)); Sector::current()->add_object(std::make_shared( Vector(get_bbox().p1.x, get_bbox().p2.y), - 90-40, 90-20, - Vector(280, -260), Vector(0, 300), 3, Color(.4f, .4f, .4f), 3, .8f, - LAYER_OBJECTS+1)); + -70, -50, 260, 280, Vector(0, 300), 3, + Color(.4f, .4f, .4f), 3, .8f, LAYER_OBJECTS+1)); Sector::current()->camera->shake(.1f, 0, 5); }