Project

General

Profile

Revision 222

more collisions

View differences:

proj_func.c
50 50
    hor_mov = key_presses.d_pressed - key_presses.a_pressed;
51 51
}
52 52

  
53
void update_movement(gunner_t *p) {
53
void update_movement(const map_t *map, gunner_t *p) {
54 54
    static const int speed = 5;
55
    gunner_set_pos(p, gunner_get_x(p) + speed * hor_mov, gunner_get_y(p) + speed * ver_mov);
55
    double x = gunner_get_x(p);
56
    double y = gunner_get_y(p);
57
    gunner_set_pos(p, x + speed * hor_mov, y + speed * ver_mov);
58
    if (map_collides_gunner(map, p)) {
59
        gunner_set_pos(p, x, y);
60
    }
56 61
}
57 62

  
58 63
void update_scale(void) {
......
69 74
            if (scale >= MIN_SCALE) ent_set_scale(scale);
70 75
        }
71 76

  
72
        printf("SCALE: %d\n", (int)(ent_get_scale()*1000));
77
        //printf("SCALE: %d\n", (int)(ent_get_scale()*1000));
73 78
    }
74 79

  
75 80
    last_plus = key_presses.plus_pressed;

Also available in: Unified diff