X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=main.c;h=f7de24e0f20c1aa38985c52bff1c59facbedc02c;hp=d2627f287d02b4747be8e73149ffd08282baf079;hb=0224eb908d4084f52a22c8d64404a0efb4acfa35;hpb=e73059d5a7394d072b17ba6c24ff7fad372bd2e8 diff --git a/main.c b/main.c index d2627f2..f7de24e 100644 --- a/main.c +++ b/main.c @@ -190,6 +190,7 @@ draw_bang_dots(SDL_Surface *s) int first_i, last_i; uint16_t *pixels, *pixel, c; int row_inc = s->pitch/sizeof(uint16_t); + Sprite *hit; pixels = (uint16_t *) s->pixels; first_i = -1; @@ -211,7 +212,14 @@ draw_bang_dots(SDL_Surface *s) } // check collisions - if(pixel_collides(bdot[i].x, bdot[i].y)) { bdot[i].active = 0; continue; } + if((hit = pixel_collides(bdot[i].x, bdot[i].y))) { + if(hit->type != SHIP) { // they shouldn't hit the ship, but they do + bdot[i].active = 0; + hit->dx += ENGINE_DOT_WEIGHT * bdot[i].life * bdot[i].dx / sprite_mass(hit); + hit->dy += ENGINE_DOT_WEIGHT * bdot[i].life * bdot[i].dy / sprite_mass(hit); + continue; + } + } pixel = pixels + row_inc*(int)(bdot[i].y) + (int)(bdot[i].x); if(bdot[i].c) c = bdot[i].c; else c = heatcolor[(int)(bdot[i].life)*3];