void BodyMemberParticle::Refresh() { m_time_left_to_live--; UpdatePosition(); angle_rad += GetSpeedXY().Norm() * 20; angle_rad = fmod(angle_rad, 2 *PI); //FIXME what about negatives values ? what would happen ? if (m_time_left_to_live < 50) image->SetAlpha(m_time_left_to_live / 50.0); image->SetRotation_rad(angle_rad); image->Update(); }
void Plane::DropBomb() { Obus * instance = new Obus(cfg); instance->SetXY(Point2i(GetX(), obus_dy)); Point2d speed_vector = GetSpeedXY(); int fx = RandomSync().GetInt(FORCE_X_MIN, FORCE_X_MAX); fx *= GetDirection(); int fy = RandomSync().GetInt(FORCE_Y_MIN, FORCE_Y_MAX); speed_vector.SetValues(speed_vector.x + fx/(Double)30.0, speed_vector.y + fy/(Double)30.0); instance->SetSpeedXY(speed_vector); ObjectsList::GetRef().AddObject(instance); last_dropped_bomb = instance; nb_dropped_bombs++; if (nb_dropped_bombs == 1) Camera::GetInstance()->FollowObject(instance); }