in procgen/src/games/jumper.cpp [389:423]
void set_action_xy(int move_action) override {
action_vx = move_action / 3 - 1;
action_vy = (move_action % 3) - 1;
if (action_vy < 0)
action_vy = 0;
if (action_vx > 0)
facing_right = true;
if (action_vx < 0)
facing_right = false;
int obj_below_1 = get_obj_from_floats(agent->x - (agent->rx - .01), agent->y - (agent->ry + .01));
int obj_below_2 = get_obj_from_floats(agent->x + (agent->rx - .01), agent->y - (agent->ry + .01));
jump_delta = 0;
has_support = can_support(obj_below_1) || can_support(obj_below_2);
if (has_support) {
jump_count = 2;
}
if (action_vy == 1 && jump_count > 0 && (cur_time - jump_time > JUMP_COOLDOWN)) {
jump_count -= 1;
jump_delta = -1;
} else {
action_vy = 0;
}
if (action_vy > 0) {
jump_time = cur_time;
}
action_vrot = 0;
}