robotz
January 19th, 2008, 12:09 PM
Hi all,
I was just wondering what your tips would be on achieving smooth horizontal scrolling in AS3? (browser based game). I've been testing two core methods: using the scroll() method of bitmapData, and using just a plain copyPixels() loop (from the hidden map data to the "screen buffer").
Both techniques work, but neither are what I'd class as "smooth" when running at speed. My game size is 576 x 416, I'm running at 30fps and there is nothing on-screen except one player (a sprite) and a background. You can see the game in progress here: http://www.fatal-design.com/gofish/ (please note this is only 4 hours work so far, don't expect Crysis ok).
I have a bitmapData object which is the game size for the "screen", and I have another bitmapData object which contains the map (the cavern walls seen in the game). The map is the same width as the screen + an extra 128 pixels. I scroll the map to the left, when I have scrolled 32 pixels I draw the next segment of the map onto the far right of it. In short the map bitmap always stays the same width and refreshes itself every 32 pixels.
As I said, this works fine, it just isn't very smooth! Ideas very welcome, thank you!
I was just wondering what your tips would be on achieving smooth horizontal scrolling in AS3? (browser based game). I've been testing two core methods: using the scroll() method of bitmapData, and using just a plain copyPixels() loop (from the hidden map data to the "screen buffer").
Both techniques work, but neither are what I'd class as "smooth" when running at speed. My game size is 576 x 416, I'm running at 30fps and there is nothing on-screen except one player (a sprite) and a background. You can see the game in progress here: http://www.fatal-design.com/gofish/ (please note this is only 4 hours work so far, don't expect Crysis ok).
I have a bitmapData object which is the game size for the "screen", and I have another bitmapData object which contains the map (the cavern walls seen in the game). The map is the same width as the screen + an extra 128 pixels. I scroll the map to the left, when I have scrolled 32 pixels I draw the next segment of the map onto the far right of it. In short the map bitmap always stays the same width and refreshes itself every 32 pixels.
As I said, this works fine, it just isn't very smooth! Ideas very welcome, thank you!