Project

General

Profile

Revision 233

gunner collision with other dudes

View differences:

proj_func.c
52 52
    hor_mov = key_presses.d_pressed - key_presses.a_pressed;
53 53
}
54 54

  
55
void update_movement(const map_t *map, gunner_t *p) {
55
void update_movement(const map_t *map, gunner_t *p, gunner_t *p2) {
56 56
    double x = gunner_get_x(p);
57 57
    double y = gunner_get_y(p);
58 58
    gunner_set_pos(p, x + SHOOTER_SPEED * hor_mov, y);
59
    if (map_collides_gunner(map, p)) {
59
    if (map_collides_gunner(map, p) || gunner_collides_gunner(p, p2)) {
60 60
        gunner_set_pos(p, x, y);
61 61
    }
62 62
    x = gunner_get_x(p);
63 63
    gunner_set_pos(p, x, y + SHOOTER_SPEED * ver_mov);
64
    if (map_collides_gunner(map, p)) {
64
    if (map_collides_gunner(map, p) || gunner_collides_gunner(p, p2)) {
65 65
        gunner_set_pos(p, x, y);
66 66
    }
67 67
}

Also available in: Unified diff