Project

General

Profile

Revision 238

changed a small thing but not yet working, go telmo!

View differences:

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

  
54
void update_movement(const map_t *map, gunner_t *p, gunner_t *p2) {
55
    double x = gunner_get_x(p);
56
    double y = gunner_get_y(p);
57
    gunner_set_pos(p, x + SHOOTER_SPEED * hor_mov, y);
58
    if (map_collides_gunner(map, p) || gunner_collides_gunner(p, p2)) {
59
        gunner_set_pos(p, x, y);
54
void update_movement(const map_t *map, list_t *shooter_list){
55
    list_node_t *it1 = list_begin(shooter_list);
56
    while(it1 != list_end(shooter_list)){
57
        double x = gunner_get_x(p);
58
        double y = gunner_get_y(p);
59
        gunner_set_pos(p, x + SHOOTER_SPEED * hor_mov, y);
60
        if (map_collides_gunner(map, p) || gunner_collides_gunner(p, p2)) {
61
            gunner_set_pos(p, x, y);
62
        }
63
        x = gunner_get_x(p);
64
        gunner_set_pos(p, x, y + SHOOTER_SPEED * ver_mov);
65
        if (map_collides_gunner(map, p) || gunner_collides_gunner(p, p2)) {
66
            gunner_set_pos(p, x, y);
67
        }
60 68
    }
61
    x = gunner_get_x(p);
62
    gunner_set_pos(p, x, y + SHOOTER_SPEED * ver_mov);
63
    if (map_collides_gunner(map, p) || gunner_collides_gunner(p, p2)) {
64
        gunner_set_pos(p, x, y);
65
    }
66 69
}
67 70

  
68 71
void (shoot_bullet)(const gunner_t *shooter, list_t *bullet_list, const basic_sprite_t *bsp_bullet) {

Also available in: Unified diff