The pipes had started way off to the right of the canvas, and by setting an x-velocity they'd slid themselves over the visible portion of the canvas and off to the left. How to make them go back?!
In coding, frequently the best ideas are the laziest.
The easy way to move all the pipes back is just to erase (blow-away) all the items in the pipes array, and then add them all back. We set the pipes array equal to an empty array, then call add_all_my_pipes, just as we did when the program first loaded.
|