void game_step()

in procgen/src/games/leaper.cpp [250:283]


    void game_step() override {
        if (agent->image_theme >= 1) {
            agent->image_theme = (agent->image_theme + 1) % FROG_ANIMATION_FRAMES;
        }

        BasicAbstractGame::game_step();

        spawn_entities();

        bool standing_on_log = false;
        float log_vx = 0.0;
        float margin = -1 * agent->rx;
        for (auto &m : entities) {
            if (m->type == LOG && has_collision(agent, m, margin)) {
                // we're standing on a log, don't die
                standing_on_log = true;
                log_vx = m->vx;
            }
        }

        if (get_obj(agent->x, agent->y) == WATER) {
            if (!standing_on_log && agent->vx == 0 && agent->vy == 0) {
                step_data.done = true;
            }
        }

        if (standing_on_log) {
            agent->x += log_vx;
        }

        if (is_out_of_bounds(agent)) {
            step_data.done = true;
        }
    }