The road is created with a combination of two images loaded near the beginning of the script, light_road.png and dark_ road.png, and also two colour strips created with light and dark tones for the grass area outside of the road. The colour of the grass is picked from the light and dark images respectively for the grass colour. Let’s look at the code that generates the graphics for the road.
if texture_position<half_texture_
position_threshold:
screen.blit(light_
strip,(0,i+HALF_SCREEN_HEIGHT))
screen.blit(light_road,(curve_
value,i+HALF_SCREEN_
HEIGHT),(0,i,SCREEN_WIDTH,1))
else:
screen.blit(dark_
strip,(0,i+HALF_SCREEN_HEIGHT))
screen.blit(dark_road,(curve_
value,i+HALF_SCREEN_
HEIGHT),(0,i,SCREEN_WIDTH,1))
As can be seen, when rendering the road, an if/else statement is used to determine whether to render a dark part of the road or a light part of the road. The grass outside of the road is rendered at the same time the road is.…