// soon as it isn't we BLOW UP
float x,y,xvel,yvel;
int active;
+ int dead; // has been blown out of the way
+ // to make room for a new ship appearing.
SDL_Surface *image;
int type_number;
float heat;
// Create a new ship and start all over again
state = GAMEPLAY;
play_tune(1);
- xvel = 3;
- yvel = 0;
+ xship -= 50;
break;
case GAME_OVER:
state = HIGH_SCORE_ENTRY;
} else {
if(state == DEAD_PAUSE) {
float blast_radius = START_RAD * state_timeout / 50.0;
+ if(xship < 60) xship = 60;
for(i = 0; i<MAXROCKS; i++ ) {
float dx, dy, n;
+ if(rock[i].x <= 0) continue;
dx = rock[i].x - xship;
dy = rock[i].y - yship;
n = sqrt(dx*dx + dy*dy);
if(n < blast_radius) {
- rock[i].xvel += rockrate*dx/n;
+ n *= 50;
+ rock[i].xvel += rockrate*(dx+30)/n;
rock[i].yvel += rockrate*dy/n;
+ rock[i].dead = 1;
}
}
}
for(i = 0; i<MAXROCKS; i++) if(rock[i].active) {
rock[i].x += rock[i].xvel*movementrate;
rock[i].y += rock[i].yvel*movementrate + yscroll;
+ if(rock[i].dead && (rock[i].y < 0 || rock[i].y > YSIZE)) rock[i].active = 0;
if(rock[i].y > YSIZE) {
rock[i].y -= YSIZE;
rock[i].y -= rock[i].image->w;
else {
state = DEAD_PAUSE;
state_timeout = 50.0;
- xship = 10;
- yship = YSIZE/2;
xvel = 0;
yvel = 0;
}
for(i = 0; i<MAXROCKS; i++ ) {
rock[i].active = 0;
+ rock[i].dead = 0;
}
rockrate = 54.0;
while(1) {
for(i = 0; i<MAXROCKS; i++) {
rock[i].active = 0;
+ rock[i].dead = 0;
}
rockrate = 54.0;
rockspeed = 5.0;