From 7f02f46188998de2767e5f057da34ac9c9d80a20 Mon Sep 17 00:00:00 2001 From: Victor Gamper Date: Sun, 26 Jan 2020 20:43:17 +0100 Subject: Added dead birds --- catch.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'catch.c') diff --git a/catch.c b/catch.c index 4c560a4..9aaa20d 100644 --- a/catch.c +++ b/catch.c @@ -19,7 +19,7 @@ SDL_Surface* image_chargebar, *image_chargebar_dark, *image_cat, *image_bird; struct Cat cat; struct Bird bird[BIRD_COUNT]; -int state, menu_state; +int state, menu_state, score; int main(int argc, char* argv[]) { memset(keyPressed,0,sizeof(keyPressed)); @@ -32,7 +32,7 @@ int main(int argc, char* argv[]) { } // create a window - screen = SDL_SetVideoMode(640, 480, 8, SDL_DOUBLEBUF | SDL_FULLSCREEN); + screen = SDL_SetVideoMode(640, 480, 8, SDL_DOUBLEBUF/* | SDL_FULLSCREEN*/); if(!screen) { printf("Could not create a SDL window! Error: %s", SDL_GetError()); return -1; @@ -119,9 +119,14 @@ int main(int argc, char* argv[]) { // draw the birds Pidgin_IncrementFrame(); for(int i = 0; iw, image_cat->h, bird[i].x, bird[i].y, image_cat->w, image_cat->h)) { - bird[i].type = BIRD_TYPE_NONE; + bird[i].type = BIRD_TYPE_DEAD_PIDGIN; } } + + } else if(bird[i].type == BIRD_TYPE_DEAD_PIDGIN) { + bird[i].y+=0.5; + + if(bird[i].y > screen->h-FLOOR_HEIGHT) { + bird[i].type = BIRD_TYPE_NONE; + } + } else { // there should be a 1 in 10 chance for a bird to spawn if(getRandomInt(10) == 1) { - bird[i].x = -100 + getRandomInt(50); - bird[i].y = 10 + getRandomInt(screen->h - FLOOR_HEIGHT - 20); + bird[i].x = -150 + getRandomInt(100); + bird[i].y = 10 + getRandomInt(screen->h - FLOOR_HEIGHT - 40); bird[i].type = BIRD_TYPE_PIDGIN; } } -- cgit v1.2.3