February 6, 2017
This past week, one of my experiments has been to program a moving road. I'd love to make a driving game, a super basic 2D game where your car moves only left and right and the road appears to move under you. I set myself the task of making just the appearance of a moving road. I used Processing (a programming language) because it's familiar; I spent a semester playing with in graduate school.
Basically, my road is a set of dashes that move down the screen each time a new frame is drawn. One dash was easy. Then I created a set of dashes to fill the screen but the set would just move down the screen, leaving it empty above the first dash. I was resetting the position of the set based on the the first dash reaching the bottom of the screen, so the rest were further below the screen edge. Now I have a set of dashes twice as tall as the screen so visually cycles. And I made it to fill whatever height screen you have. Extra credit. But this method isn't efficient because I have twice as many dashes as I need. My next experiment could be to find a way to drop the dashes onto the screen individually, starting each one over as it reaches the bottom.