This is an old revision of the document!
An infinite runner involves a character moving along an infinitely long stage overcoming obstacles placed along the path. That's the foundation. Other additions can include an increasing speed, procedurally generated obstacles, etc.
A parallax background involves multiple layers scrolling along at different speeds to simulate depth. Layers farther back in the scene move slower than those closer to the camera.
Each layer needs at least a X Position and Speed variables. On each frame, the X Position is subtracted by the Speed, so that the layer moves at a constant rate. Once the layer moves off-screen, increment its' X Position by the width of the layer asset so it's back on-screen and the scrolling effect doesn't have any cuts. (For simplicity, each layer asset is the width of the screen size.)
Sometimes you want to include alternate variants of a layer asset for added visual flair. This'll require an array for however many slots you want within the layer (For this example, we'll go six with the last slot being the variant). We'll use a type variable to determine which asset variant to select (a boolean). When rendering the layer, it looks at the type to determine the texture variant to select.