X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=main.c;h=68c77a4a8566ab702be17fb4d583c9ea0e2bfd6e;hp=03d173c9c875921b4f2f0fca00f216ce39eadd9f;hb=ed4ff736c245071157dc5412edb0218b8cc3e442;hpb=cf30b5f20e3c6fa5c6a328f6cb9ad1559cf227a2 diff --git a/main.c b/main.c index 03d173c..68c77a4 100644 --- a/main.c +++ b/main.c @@ -54,6 +54,8 @@ struct rock_struct { // 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; @@ -1002,15 +1004,9 @@ int gameloop() { // Create a new ship and start all over again state = GAMEPLAY; play_tune(1); - xship = 10; - yship = YSIZE/2; - xvel = 3; - yvel = 0; - for(i = 0; i YSIZE) { - rock[i].y -= YSIZE; - rock[i].y -= rock[i].image->w; - } else if(rock[i].y < -rock[i].image->w) { - rock[i].y += YSIZE; - rock[i].y += rock[i].image->w; - } - if(rock[i].x<-32.0) - rock[i].active = 0; + 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 if(rock[i].y < -rock[i].image->w) { + rock[i].y += YSIZE; + rock[i].y += rock[i].image->w; + } + if(rock[i].x < -32.0) rock[i].active = 0; } @@ -1148,7 +1161,8 @@ int gameloop() { else { state = DEAD_PAUSE; state_timeout = 50.0; - + xvel = 0; + yvel = 0; } } @@ -1163,6 +1177,7 @@ int gameloop() { for(i = 0; i