From 3bc5679ced4a7f458f85f8fb3eefe3b679034aef Mon Sep 17 00:00:00 2001 From: Janos <janol55@zedat.fu-berlin.de> Date: Sun, 14 Apr 2024 16:18:08 +0200 Subject: [PATCH] Spieler kann nicht mehr auf einem Stein starten --- hDateien/rows.h | 2 -- map.c | 2 ++ rows.c | 10 +--------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/hDateien/rows.h b/hDateien/rows.h index b637cbb..16a93a2 100644 --- a/hDateien/rows.h +++ b/hDateien/rows.h @@ -14,8 +14,6 @@ //Declaration of functions -int gen_stone(); - struct Row* race(int); struct Row* init_row(struct Row*); struct Row* grass(bool,bool,int); diff --git a/map.c b/map.c index d56f334..fa1a050 100644 --- a/map.c +++ b/map.c @@ -136,6 +136,8 @@ int move_map(enum vehicle theme,int delta_y,struct LinkedList *list, SDL_Rendere player->y += ROW_SIZE; player->x -= ROW_SIZE; playerscore--; + }else{ + player->x += ROW_SIZE; } } } diff --git a/rows.c b/rows.c index a76856a..4867d2b 100644 --- a/rows.c +++ b/rows.c @@ -1,13 +1,5 @@ #include "hDateien/rows.h" -// Vorbedingnug: / - -// Nachbedingung: gibt eine zufällige Position für ein Stein zurück - -int gen_stone(){ - int p = (rand() % 9)*ROW_SIZE; - return(p); -} //Vorbedingung: -200<=y_pos<=1000 @@ -55,7 +47,7 @@ struct Row* grass(bool dark,bool gold,int y_pos){ int p = rand() % 10; if (p < 7){ - n->stone = gen_stone(); + n->stone = (rand() % 9)*ROW_SIZE; n->bird = NULL; }else{ p = (rand() % 10) * ROW_SIZE; -- GitLab