Example #1
0
void become_ascender(Lixxie& l)
{
    l.become_default(LixEn::ASCENDER);

    // determine the height to step up. Seek a floor pixel with air above it.
    int swh = 0;
    while (swh < 26 && ! (l.is_solid(0, 2 - swh) && ! l.is_solid(0, 1 - swh)))
        ++swh;
    int frame = 5; // this is the last frame
    switch (swh) {
        case 0:  case 1:
        case 2:  case 3:  frame = 5; break;
        case 4:  case 5:  frame = 4; break;
        case 6:  case 7:  frame = 3; break;
        case 8:  case 9:  frame = 2; break;
        case 10: case 11: frame = 1; break;
        default:          frame = 0; break;
    }
    int swh_wanted = 10 - frame * 2;
    l.set_frame(frame);

    // Move up, [check for even cliff,] move down again
    l.move_up(swh);
    // This was in earlier versions to look good, but the community frowned
    // on it for inconsistency; and sometimes the skipped x-pixels have indeed
    // yielded problems.
    // if (! l.is_solid(2, 0) && ! l.is_solid(2, 1)) l.move_ahead();
    l.move_down(swh_wanted);
}
Example #2
0
void become_drowner(Lixxie& l)
{
    int drowner_frame = 0;
    if (l.get_ac() == LixEn::TUMBLER
        && l.get_frame() > tumbler_frame_steep_drown) {
        drowner_frame = drowner_steep_frame;
    }
    l.become_default(LixEn::DROWNER);
    l.set_frame(drowner_frame);
}
Example #3
0
void become_platformer(Lixxie& l)
{
    const bool continue_on_same_height
        = (l.get_ac() == LixEn::SHRUGGER2
        && l.get_frame() < platformer_standing_up_frame);

    l.become_default(LixEn::PLATFORMER);
    l.set_special_x(12);
    l.set_frame(continue_on_same_height ? 16 : 0);
}
Example #4
0
void become_jumper(Lixxie& l)
{
    l.become_default(LixEn::JUMPER);
    if (l.get_runner()) {
        l.set_special_x(  8); // X-speed
        l.set_special_y(-12); // Y-speed
    }
    else {
        l.set_special_x( 6); // X-speed
        l.set_special_y(-8); // Y-speed
    }

    for (int i = -4; i > -16; --i)
     if (l.is_solid(0, i)) {
        l.become(LixEn::STUNNER);
        return;
    }
}
Example #5
0
void become_faller(Lixxie& l)
{
    l.become_default(LixEn::FALLER);
    l.set_special_y(4);
}
Example #6
0
void become_builder(Lixxie& l)
{
    l.become_default(LixEn::BUILDER);
    l.set_special_x(12);
    l.set_frame(6);
}
Example #7
0
void become_exiter(Lixxie& l)
{
    l.become_default(LixEn::EXITER);
    l.set_updates_since_bomb(0);
}