X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=main.c;h=4ffcb250cbbb7370eafb4c1907426ee22ad42f54;hp=d2627f287d02b4747be8e73149ffd08282baf079;hb=0a50d8514cb73c25964068602ec458c6ac46ba22;hpb=e73059d5a7394d072b17ba6c24ff7fad372bd2e8 diff --git a/main.c b/main.c index d2627f2..4ffcb25 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]; @@ -624,12 +632,7 @@ gameloop() { } } else { if(state == DEAD_PAUSE) { - float blast_radius; // float alpha; // FADE SHIP - if(state_timeout >= DEAD_PAUSE_LENGTH - 20.0) { - blast_radius = BLAST_RADIUS * (DEAD_PAUSE_LENGTH - state_timeout) / 20.0; - blast_rocks(bangx, bangy, blast_radius); - } if(bangx < 60) bangx = 60;