herdem_sheep.c
/**
 * Handler for when a sheep hits the wall
 */
Handler for when a sheep hits the wall
Handler for when a sheep hits the wall
void herdem_sheep_wall_handler(jty_c_info *c_info)
{
    jty_actor *a = c_info->e1.actor;
    herdem_sheep *sheep = (herdem_sheep *)a;
    a->x -= c_info->normal.x * (c_info->penetration + 1);
    a->y -= c_info->normal.y * (c_info->penetration + 1);
    sheep->touching_wall = HERDEM_SHEEP_WALL_RECOVER_FRAMES;
    if (c_info->normal.x) {
        a->vx *= -1;
    } if (c_info->normal.y) {
        a->vy *= -1;
    }
    if (sheep->panicked == true) {
        if (c_info->normal.x) {
            a->vx = 0;
            a->ax = 0;
        }else {
            a->vy = 0;
            a->ay = 0;
        }
    }
}
void herdem_sheep_wall_handler ( jty_c_info * c_info ) { jty_actor * a = c_info -> e1 . actor ; herdem_sheep * sheep = ( herdem_sheep * ) a ; a -> x -= c_info -> normal . x * ( c_info -> penetration + 1 ) ; a -> y -= c_info -> normal . y * ( c_info -> penetration + 1 ) ; sheep -> touching_wall = HERDEM_SHEEP_WALL_RECOVER_FRAMES ; if ( c_info -> normal . x ) { a -> vx *= -1 ; } if ( c_info -> normal . y ) { a -> vy *= -1 ; } if ( sheep -> panicked == true ) { if ( c_info -> normal . x ) { a -> vx = 0 ; a -> ax = 0 ; } else { a -> vy = 0 ; a -> ay = 0 ; } } }
Handler for when a sheep hits the wall
Handler for when a sheep hits the wall