Skip to content
Snippets Groups Projects
Commit b6692783 authored by Janos's avatar Janos
Browse files

Bugfix

parent 7a2a30d9
Branches
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@ struct Car* init_car(int speed,int width,int height,int pred_pos,int pred_width,
perror("kein Speicherplatz");
}
int min_distance;
int distance;
int p = rand() % 10;
......@@ -31,13 +32,19 @@ struct Car* init_car(int speed,int width,int height,int pred_pos,int pred_width,
}else{
distance = 25;
}
if (speed < 0){
b->x_pos = pred_pos + pred_width + distance;
}else{
b->x_pos = pred_pos - b->width - distance;
}
}else{
b->width = width;
b->height = height;
if (t == coin || t == coin_gathered)
if (t == coin || t == coin_gathered){
b->type = car;
else{
}else{
b->type = t;
}
if (pred_width == 0){ // kein Vorgänger
......@@ -54,15 +61,14 @@ struct Car* init_car(int speed,int width,int height,int pred_pos,int pred_width,
min_distance = 50 * abs(speed) + 50;
distance = (rand() % 500) + min_distance;
}
}
}
if (speed < 0){
b->x_pos = pred_pos + pred_width + distance;
}else{
b->x_pos = pred_pos - b->width - distance;
if (speed < 0){
b->x_pos = pred_pos + pred_width + distance;
}else{
b->x_pos = pred_pos - b->width - distance;
}
}
}
return(b);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment