Calculator Community > General Calculator Help

[68k general] Map Scrolling

(1/2) > >>

mdjenkins86:
What is the best way to create a map scroller.  I mean. do you store the sprite in a list and then update the screen as the positon on the character reaches a certain point.  If so, how do you stop strolling when the charater reaches the edge of the map

Liazon:
Well, to answer your second question, what I do is that I have a set of camera variables that follow the character so that the character is in the center of the screen, unless the camera coordinates are no longer on the map.  In that case, I just set it to the nearest value in the domain.

I use the tilemap engine that comes with Extgraph, but I don't think that's necessary unless you're doing hardcore stuff (stupid contest entry that won't work right) or greyscale.  It will update accordingly and you don't need to clear the screen before calling the drawplane routine again.  Drawplane will replace the previous screen contents.  The engine uses a buffer to draw out a section of the map that's bigger than the screen, and uses the map coordinates to figure out when to update, and what section to copy to LCD memory.

mdjenkins86:
That last part is really interesting.  This can obviously only be done in C though...buffering a section of the map (which is bigger than the screen) in memory and updating the lcd memory...obiously I need to be mesing with Extgraph as you said before....*goes to do research*

Thanks again

Liazon:
no problem, if you ask me, Extgraph is an amazing jewel in the 68k community.  I think it harnesses a lot of power for TIGCC programmers to use to make really incredible games without 68k ASM knowledge.

btw, based on z80 experience (I've never written an ASM scrolling tilemapper) the tilemappers that I've seen others written on z80 calcs are all customized to fit the needs of their games.  One general purpose scrolling tilemapper will scroll all the tiles first, then display them on the screen.  This works really well if you have very few tiles in your tileset, because then the routine won't have to take 1000s of t-states to draw the buffer, but instead just buffer all the tiles.  However, if you have more than 96 tiles (about the # of 8x8 tiles that fit on an 83+) it becomes inefficient because the likeliness of all the tiles to appear on the screen is low.  

The other tilemapper I've seen at revsoft will do exactly as I described, buffer and copy, and then update the buffer when necessary.

crzyrbl:
the demo that came with xLib was a perfert example of how to do map scrolling...just had a speed problem because of all the gotos.  definitely look it up if you got a ti-8x+

Navigation

[0] Message Index

[#] Next page

Go to full version