angle = master->angle + M_PI;
while (angle < 0) { angle += 2*M_PI; }
while (angle > 2*M_PI) { angle -= 2*M_PI; }
- Vector dest = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size() * 0.5);
+ Vector dest = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5);
movement = dest - get_pos();
}
if (this == master) {
while (angle < 0) { angle += 2*M_PI; }
while (angle > 2*M_PI) { angle -= 2*M_PI; }
angular_speed = std::min(std::max(angular_speed, static_cast<float>(-128*M_PI*elapsed_time)), static_cast<float>(128*M_PI*elapsed_time));
- Vector dest = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size() * 0.5);
+ Vector dest = center + Vector(cosf(angle), sinf(angle)) * radius - (bbox.get_size().as_vector() * 0.5);
movement = dest - get_pos();
center += Vector(angular_speed, 0) * elapsed_time * 32;
Block::draw(context);
// then Draw the light if on.
if(sprite->get_action() == "on") {
- Vector pos = get_pos() + (bbox.get_size() - lightsprite->get_size()) / 2;
+ Vector pos = get_pos() + (Vector(bbox.get_size().as_vector()) - lightsprite->get_size()) / 2;
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
context.draw_surface(lightsprite, pos, 10);
void
MovingSprite::set_action_centered(const std::string& action, int loops)
{
- Vector old_size = bbox.get_size();
+ Vector old_size = bbox.get_size().as_vector();
sprite->set_action(action, loops);
set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
- set_pos(get_pos() - (bbox.get_size() - old_size) / 2);
+ set_pos(get_pos() - (Vector(bbox.get_size().as_vector()) - old_size) / 2);
}
void