Project

General

Profile

Revision 233

gunner collision with other dudes

View differences:

ent.c
260 260
    return distance <= shooter_radius+bullet_radius;
261 261
}
262 262

  
263
int (gunner_collides_gunner)(const gunner_t *shooter1, const gunner_t *shooter2) {
264
    double shooter1_radius = max(sprite_get_w(shooter1->dude), sprite_get_h(shooter1->dude))/2.0;
265
    double shooter1_x = gunner_get_x(shooter1);
266
    double shooter1_y = gunner_get_y(shooter1);
267

  
268
    double shooter2_radius = max(sprite_get_w(shooter2->dude), sprite_get_h(shooter2->dude))/2.0;
269
    double shooter2_x = gunner_get_x(shooter2);
270
    double shooter2_y = gunner_get_y(shooter2);
271

  
272
    double dx = shooter1_x - shooter2_x;
273
    double dy = shooter1_y - shooter2_y;
274
    double distance = sqrt(dx*dx + dy*dy);
275
    return distance <= shooter1_radius+shooter2_radius;
276
}
277

  
263 278
void   (map_draw)(map_t *p){
264 279
    const int16_t x_screen = map_get_x_screen(p);
265 280
    const int16_t y_screen = map_get_y_screen(p);

Also available in: Unified diff