Fast endless scrolling background
I'm trying to create a endlessly scrolling bitmap background. I want to make it as efficient as possible as there is plenty of other game logic going on too.
The idea is to have a repeatable bitmap scroll horizontal开发者_StackOverflowly on an endless loop, which can obviously be achieved by placing two sprites of the same bitmap next to each other and offsetting one when it reaches the far left boundary.
I was wondering if there is perhaps a faster more efficient way to do this, perhaps using scrollRect or copyPixels? If anyone has any idea which method would be fastest, and perhaps some code to show me how it could be achieved I'd be extremely grateful!
Cheers!
Make a seamless looping image ( by cleverly joining the two) then, have a look at this older articles:
- Andre Michelle's Tile Mapping
- Senocular's Sprite scrolling
There should be some updated examples out there. Make a test with Grant Skinner Performance test and see what's faster for your setup, copyPixels() or scroll()
HTH, George
精彩评论