I was wondering if someone could help me understand the concept of how to make a tile map scroll smoothly. I have a few ideas on how to do it, but i'm not sure which is better (speed, size, or both), or if i'm completely off the target here.

Idea 1: Scroll the screen, filling in the missing parts as it scrolls.

Idea 2: Have a buffer that's slightly bigger (1 sprite-length) than the screen. Scroll around by shifting around the buffer, and only re-draw "unvisible" sprites when map is "re-aligned"
I'll be honest, both ideas kind of sound like the exact same thing. The only difference being that "Idea 1" deals with how to draw it, while "Idea 2" deals with how to store it.
Personally, I think the 2nd idea is easier.
Kllrnohj wrote:
I'll be honest, both ideas kind of sound like the exact same thing. The only difference being that "Idea 1" deals with how to draw it, while "Idea 2" deals with how to store it.
I agree with Kllrnohj; both of the ideas that you mention seem to be different details about how to do the same thing the same way.
Maybe I wasn't clear enough...

idea 1: Draw to a buffer a 14*10 (as opposed to a 12*Cool tilemap (8*Cool. Then, shift around this tilemap smoothly, and only refresh the buffer when then screen "re-aligns"

idea 2: Draw a 12*8 tilemap. Shift it around, filling in the blank edges as needed (masked sprites and such).
Since you can't change where the screen buffer resides, I still think both ideas sound the same.

Here, lets take your two ideas and combine them so you can see what I mean.

Draw to a buffer a 14*10 (as opposed to a 12*8) tilemap (8*8). Then, [Shift it around, filling in the blank edges as needed (masked sprites and such).], and only refresh the buffer when then screen "re-aligns"

Hence, your two ideas are just one idea, with each dealing with only a part of the overall idea. Either that, or you still aren't being clear enough as to what the differences actually are...
Ok, that's exactly idea 1.

Let's try this (assume 1's are black 8*8 squares, and 0's are blank 8*8 squares)
Screen Buffer data:
1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,0,0,0,0,0,0,0,0,0,0,0,0,1
1,0,0,0,0,0,0,0,0,0,0,0,0,1
1,0,0,0,0,0,0,0,0,0,0,0,0,1
1,0,0,0,0,0,0,0,0,0,0,0,0,1
1,0,0,0,0,0,0,0,0,0,0,0,0,1
1,0,0,0,0,0,0,0,0,0,0,0,0,1
1,0,0,0,0,0,0,0,0,0,0,0,0,1
1,0,0,0,0,0,0,0,0,0,0,0,0,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1

Map pointer is the top left 0. Although the buffer shows an outline box, the LCD is displaying a blank screen. When you shift, data is shifted on this buffer, then i only need to re-update the "edges" of the buffer everytime the buffer re-aligns.

Idea 2:
0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0

To achieve a similar effect, this is what the buffer (12*Cool here would look like. When shifted, say right, then there would be a gap on the left side. This would be filled by finding the sprites on the left and then filling them in during the shifting routine.

I'm sorry it's not that clear, but I don't really have code to show either way that clearly.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement