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);
}
// dust some particles
Sector::current()->add_object(
std::make_shared<Particles>(
- 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 {
on_ground_flag = false;
Sector::current()->add_object(std::make_shared<Particles>(
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<Particles>(
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);
}