Amelioration code + commentaires. Rectifications erreurs etc.
This commit is contained in:
50
scene.c
50
scene.c
@@ -29,7 +29,18 @@ PIXELS gen_pastille(PIXELS *serpent,PIXELS *pastilles,PIXELS *obstacle,unsigned
|
||||
ok = 0;
|
||||
x_pastille= ArrondirPixel(rand()%W_GAME);
|
||||
y_pastille = ArrondirPixel(rand()%H_GAME);
|
||||
for(i=0;i<longueur_serpent;i++)
|
||||
|
||||
if(x_pastille < DECALEMENT)
|
||||
{
|
||||
x_pastille =+ DECALEMENT;
|
||||
}
|
||||
|
||||
if(y_pastille < DECALEMENT)
|
||||
{
|
||||
y_pastille =+ DECALEMENT;
|
||||
}
|
||||
|
||||
for(i=0;i<=longueur_serpent;i++)
|
||||
{
|
||||
if(x_pastille == serpent[i].x && y_pastille == serpent[i].y)
|
||||
{
|
||||
@@ -41,7 +52,7 @@ PIXELS gen_pastille(PIXELS *serpent,PIXELS *pastilles,PIXELS *obstacle,unsigned
|
||||
}
|
||||
|
||||
}
|
||||
for(i=0;i<longueur_obstacle;i++)
|
||||
for(i=0;i<=longueur_obstacle;i++)
|
||||
{
|
||||
if(x_pastille == obstacle[i].x && y_pastille == obstacle[i].y)
|
||||
{
|
||||
@@ -55,16 +66,6 @@ PIXELS gen_pastille(PIXELS *serpent,PIXELS *pastilles,PIXELS *obstacle,unsigned
|
||||
}
|
||||
}while(ok);
|
||||
|
||||
if(x_pastille < DECALEMENT)
|
||||
{
|
||||
x_pastille =+ DECALEMENT;
|
||||
}
|
||||
|
||||
if(y_pastille < DECALEMENT)
|
||||
{
|
||||
y_pastille =+ DECALEMENT;
|
||||
}
|
||||
|
||||
|
||||
pastille.x = x_pastille ;
|
||||
pastille.y = y_pastille ;
|
||||
@@ -85,7 +86,18 @@ PIXELS gen_obstacle(PIXELS *serpent,PIXELS *pastilles,PIXELS *obstacle,unsigned
|
||||
ok = 0;
|
||||
x_obstacles= ArrondirPixel(rand()%W_GAME);
|
||||
y_obstacles = ArrondirPixel(rand()%H_GAME);
|
||||
for(i=0;i<longueur_serpent;i++)
|
||||
|
||||
if(x_obstacles < DECALEMENT)
|
||||
{
|
||||
x_obstacles =+ DECALEMENT;
|
||||
}
|
||||
|
||||
if(y_obstacles < DECALEMENT)
|
||||
{
|
||||
y_obstacles =+ DECALEMENT;
|
||||
}
|
||||
|
||||
for(i=0;i<=longueur_serpent;i++)
|
||||
{
|
||||
if(x_obstacles == serpent[i].x && y_obstacles == serpent[i].y)
|
||||
{
|
||||
@@ -97,7 +109,7 @@ PIXELS gen_obstacle(PIXELS *serpent,PIXELS *pastilles,PIXELS *obstacle,unsigned
|
||||
}
|
||||
|
||||
}
|
||||
for(i=0;i<longueur_pastilles;i++)
|
||||
for(i=0;i<=longueur_pastilles;i++)
|
||||
{
|
||||
if(x_obstacles == pastilles[i].x && y_obstacles == pastilles[i].y)
|
||||
{
|
||||
@@ -111,16 +123,6 @@ PIXELS gen_obstacle(PIXELS *serpent,PIXELS *pastilles,PIXELS *obstacle,unsigned
|
||||
}
|
||||
}while(ok);
|
||||
|
||||
if(x_obstacles < DECALEMENT)
|
||||
{
|
||||
x_obstacles =+ DECALEMENT;
|
||||
}
|
||||
|
||||
if(y_obstacles < DECALEMENT)
|
||||
{
|
||||
y_obstacles =+ DECALEMENT;
|
||||
}
|
||||
|
||||
|
||||
obstacles.x = x_obstacles ;
|
||||
obstacles.y = y_obstacles ;
|
||||
|
||||
Reference in New Issue
Block a user