So - I’m kinda stumped, and am hoping that someone has seen and solved this problem.
I’m trying to make a scrolling starfield for a space game I’m working on - to give the impression of movement, your ship stays centered on the screen (top-down view), and the stars scroll by as you move.
My initial implementation of this is to make a screen-sized image, fill it with a few hundred random white dots, and do 4 sprite() calls to tile it on the screen based on the player’s x,y coordinates. I hope that explanation makes sense.
Problem is, when I do that I get very dim, flickery stars - they’re nice and steady if you are stopped, but moving, they fade to practically nothing.
I’ve tried removing the “background(0,0,0,0)” call at the beginning of the draw() loop, if anything it makes it worse.
I’ve also tried one big image, or even small - still dim, so it doesn’t appear to be time drawing sprites (which I didn’t expect anyway).
I have yet to experiment with mesh() or modifying the page switching; I can’t believe mesh will be much faster than one image() draw, even a big one (it seems to run at a fine frame rate, but I’ve not measured it), and I kinda don’t want to mess with page switching because I suspect it’ll mess with the stuff I want to draw on top of the starfield…
Open to suggestions and sample code if anyone has got a scrolling background working… (It may be a side effect of teensy white dots on a largely black screen, to be frank… I’ll experiment with larger dots next…)