void spawn_entities()

in procgen/src/games/leaper.cpp [185:215]


    void spawn_entities() {
        // cars
        for (int lane = 0; lane < int(road_lane_speeds.size()); lane++) {
            float speed = road_lane_speeds[lane];
            float spawn_prob = fabs(speed) / 6.0;
            if (rand_gen.rand01() < spawn_prob) {
                float x = speed > 0 ? (-1 * MONSTER_RADIUS) : (main_width + MONSTER_RADIUS);
                auto m = std::make_shared<Entity>(x, bottom_road_y + lane + 0.5, speed, 0, 2 * MONSTER_RADIUS, MONSTER_RADIUS, CAR);
                choose_random_theme(m);
                if (speed < 0) {
                    m->rotation = PI;
                }
                if (!has_any_collision(m)) {
                    entities.push_back(m);
                }
            }
        }

        // logs
        for (int lane = 0; lane < int(water_lane_speeds.size()); lane++) {
            float speed = water_lane_speeds[lane];
            float spawn_prob = fabs(speed) / 2.0;
            if (rand_gen.rand01() < spawn_prob) {
                float x = speed > 0 ? (-1 * LOG_RADIUS) : (main_width + LOG_RADIUS);
                auto m = std::make_shared<Entity>(x, bottom_water_y + lane + 0.5, speed, 0, LOG_RADIUS, LOG);
                if (!has_any_collision(m)) {
                    entities.push_back(m);
                }
            }
        }
    }