put ship back in center of screen at start.
explosion now in same place as ship.
#define MAXENGINEDOTS 5000
#define MAXBANGDOTS 50000
#define MAXSPACEDOTS 2000
#define MAXENGINEDOTS 5000
#define MAXBANGDOTS 50000
#define MAXSPACEDOTS 2000
#define W 100
#define M 255
#define BLAST_RADIUS 300 // radius^2 (pixels) which will be cleared of rocks when you die
#define W 100
#define M 255
#define BLAST_RADIUS 300 // radius^2 (pixels) which will be cleared of rocks when you die
for(i = 0; i<MAXSPACEDOTS; i++) {
sdot[i].x = rnd()*(XSIZE-5);
sdot[i].y = rnd()*(YSIZE-5);
for(i = 0; i<MAXSPACEDOTS; i++) {
sdot[i].x = rnd()*(XSIZE-5);
sdot[i].y = rnd()*(YSIZE-5);
- sdot[i].z = 4*rnd();
- b = (4 - sdot[i].z) * 255.0 / 4;
+ sdot[i].z = MAXDUSTDEPTH*sqrt(rnd());
+ b = (MAXDUSTDEPTH - sdot[i].z) * 255.0 / MAXDUSTDEPTH;
sdot[i].color = SDL_MapRGB(surf_screen->format, b, b, b);
}
}
sdot[i].color = SDL_MapRGB(surf_screen->format, b, b, b);
}
}
if(shipx<0 || shipx>XSIZE-surf_ship->w) {
// BOUNCE from left and right wall
shipx -= shipdx*gamerate;
if(shipx<0 || shipx>XSIZE-surf_ship->w) {
// BOUNCE from left and right wall
shipx -= shipdx*gamerate;
}
// BOUNCE Y
if(shipy<0 || shipy>YSIZE-surf_ship->h) {
// BOUNCE from top and bottom wall
}
// BOUNCE Y
if(shipy<0 || shipy>YSIZE-surf_ship->h) {
// BOUNCE from top and bottom wall
+ printf("bouncing top/bottom.\n");
shipy -= shipdy;
shipdy *= -0.99;
}
shipy -= shipdy;
shipdy *= -0.99;
}
// Play the explosion sound
play_sound(0);
make_bang_dots(shipx,shipy,shipdx,shipdy,surf_ship,30);
// Play the explosion sound
play_sound(0);
make_bang_dots(shipx,shipy,shipdx,shipdy,surf_ship,30);
shipdy = 0;
if(--nships <= 0) {
gameover = 1;
shipdy = 0;
if(--nships <= 0) {
gameover = 1;
play_tune(1);
gameover = 0;
play_tune(1);
gameover = 0;
n = sqrt(dx*dx + dy*dy);
if(n < radius) {
n *= 20;
n = sqrt(dx*dx + dy*dy);
if(n < radius) {
n *= 20;
- rock[i].dx += 54.0*(dx+30)/n;
+ rock[i].dx += 54.0*dx/n;
rock[i].dy += 54.0*dy/n;
}
}
rock[i].dy += 54.0*dy/n;
}
}