X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=main.c;h=97f7a674cd6c567943fadddc5d67037c63ae61fa;hp=489c35290673746a5297ed7e0dec3a6bf839f2f2;hb=6caf37b784ff48aeed88c279a14c4a210baaee42;hpb=fac9f096e69b8e1594a90796ec8dcf222fc1b6e3 diff --git a/main.c b/main.c index 489c352..97f7a67 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; @@ -134,6 +136,7 @@ float xvel,yvel; // Change in X position per tick. float rockrate,rockspeed; float movementrate; float yscroll; +float scrollvel; int nships,score,initticks,ticks_since_last, last_ticks; int gameover; @@ -1001,15 +1004,7 @@ 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; } @@ -1143,8 +1159,9 @@ int gameloop() { } else { state = DEAD_PAUSE; - state_timeout = 50.0; - + state_timeout = 20.0; + xvel = 0; + yvel = 0; } } @@ -1159,6 +1176,7 @@ int gameloop() { for(i = 0; i