source/rover.c
void rover_elevate(struct Rover* rover, int scroll) {
    /* find the height of each wheel
     * & 0xff is the same thing as % 256 but faster */
    for (int i = 0; i < NUM_WHEELS; i++) {
        rover->wheel_height[i] = (GROUND_HEIGHT - ground_height[(rover->x +
                scroll + (WHEEL_SIZE >> 1) + WHEEL_SPACING * i) & 0xff])
                << VERT_SHIFT_AMOUNT;
    }

    /* set the rover's position to that of the highest wheel */
    rover->y = rover->wheel_height[0];
    for (int i = 1; i < NUM_WHEELS; i++) {
        if (rover->y > rover->wheel_height[i]) {
            rover->y = rover->wheel_height[i];;
        }
    }
}
/* update the rover Y position on screen */
update the rover Y position on screen
update the rover Y position on screen
void rover_elevate(struct Rover* rover, int scroll) {
    for (int i = 0; i < NUM_WHEELS; i++) {
        rover->wheel_height[i] = (GROUND_HEIGHT - ground_height[(rover->x +
                scroll + (WHEEL_SIZE >> 1) + WHEEL_SPACING * i) & 0xff])
                << VERT_SHIFT_AMOUNT;
    }
    rover->y = rover->wheel_height[0];
    for (int i = 1; i < NUM_WHEELS; i++) {
        if (rover->y > rover->wheel_height[i]) {
            rover->y = rover->wheel_height[i];;
        }
    }
}
void rover_elevate ( struct Rover * rover , int scroll ) { for ( int i = 0 ; i < NUM_WHEELS ; i ++ ) { rover -> wheel_height [ i ] = ( GROUND_HEIGHT - ground_height [ ( rover -> x + scroll + ( WHEEL_SIZE >> 1 ) + WHEEL_SPACING * i ) & 0xff ] ) << VERT_SHIFT_AMOUNT ; } rover -> y = rover -> wheel_height [ 0 ] ; for ( int i = 1 ; i < NUM_WHEELS ; i ++ ) { if ( rover -> y > rover -> wheel_height [ i ] ) { rover -> y = rover -> wheel_height [ i ] ; ; } } }
update the rover Y position on screen
update the rover Y position on screen
/* find the height of each wheel
     * & 0xff is the same thing as % 256 but faster */ /* set the rover's position to that of the highest wheel */