Working with a bunch of student projects that use code like the above. We are finding that when scrolling, there is choppiness to the background, like it sticks and unsticks unpredictably.
I’ve tried limiting the number of background and ground sprites, and overlapping the ground and background by different amounts. I’ve tried moving the camera velocity update from a separate function into the draw loop, and moved it to different positions in there. I’ve tried increasing and decreasing the scrolling speed. None of those things seems to make a difference.
Works great for me. Sometimes this happens when student devices have memory issues.
What device are you using?
Hello @134852e ,
What a fun game! Like @mriley, I also didn’t experience any choppiness on my machine, so it could be a local machine or network issue.
I have see that before with longer games, though. The code.org platform is a training ground for future software developers (today’s students) and isn’t going to be fully optimized for creating a flawlessly executed game, so the more resources you use, the more likely that is to happen. I think what you’ve tried is the best approach and it can eliminate a lot of these issues.
I looked at your code and didn’t see any red flags (like creating sprites inside the draw loop), but it could be groups that slows things down a little as well, although, I would have done the same thing!
Hopefully you can get it to work as well as I have.
Thanks for your reply! We are using iMacs that are about two years old. After reading mwood’s reply, I’m wondering if it’s a network issue as we’ve had problems with that in the past.
Thanks for your reply! Yes, maybe a network issue as we’ve had problems with that in the past. I’ll keep at it.
I did have issues. I am using a Macbook pro.
Hmmm … I’m on a 4 year old Macbook pro and didn’t have problems. I guess it really must depend on the network, the devices and who knows what else. I hope they figure it out.