My students want to use the sprite backgrounds from the animation tab for their side-scroller game. However, when they “move” (bg.x=bg.x-1) the sprite to mimic the example, the image turns into streaks, and we can’t figure out how to move the background the left side of the grid and loop it before the streaks appear. I’ve done some research and learned that we can have the background move with the player when the arrow keys are pressed, but that’s not the “look” they’re going for. Any advice?
Can you send us a link to your project so we can see the streak effect? Usually, that happens when you move a sprite, but don’t redraw the background within the draw loop. Not quite sure what you mean by looping the background without looking at your project.
The link worked. I’m also not seeing any streaking. I do see a seam, but as long as the left and right are different, ther’es no way to avoid that. Have you tried it on a different computer? I don’t see any streakyineeess, but maybe i’ m missing something.
I updated the code to only show 1 background. This is how most of my students try to set up their games. The streaks appear on the right once the background begins to move.
I tried to “fix” it by placing 2 identical backgrounds back-to-back and looping them. The seam is unavoidable, but it does work so much better.
The reason the double background works is that the 2nd one covers up the tracks (streaks) of the first one. If you were able to create a background where the left and right side matched up, the seam would also disappear, but that would probably involve the students creating their own background instead of using a pre-existing one.