Re: A86: Question on tile maps


[Prev][Next][Index][Thread]

Re: A86: Question on tile maps




I've found that instead of using a SLOW sprite routine that saves the
background, it's almost always much faster and easier to just save the
background each frame into a secondary buffer.  I call it "tripple
buffering".  You have your Video Ram or Video Buffer, Virtual Screen or
Double Buffer, and you have the Map Screen or Map Buffer.

You draw the map to the Map Buffer.  At the beginning of each frame (top of
the main loop), copy the Map Buffer to the Virtual Screen.  This will
effectively erase any sprites that were drawn the previous frame.  During
the frame, use whatever putsprite routine that you want and draw your
sprites to the Virtual Screen.  Don't worry about where they were or what
was behind, them, just draw them as fast as possible.  At the end of the
frame, copy the Virtual Screen to Video Ram.  This will save you alot of
effort when programming, and it will be much faster if you have more than
two or three on screen sprites.  An extra 21000 t's for a buffer copy isn't
much at all.

Some example equates for this would be...

VideoRam = $fc00
VirtScr  = $f600
MapScr   = $8100

Example main loop...  (a little easier to understand than asm, maybe)

main_loop:
  copy MapScr to VirtScr

  ...
  draw sprites and do other stuff
  ...

  copy VirtScr to VideoRam
goto main_loop

--
David Phillips <david@acz.org>
http://www.acz.org/

----- Original Message -----
From: Andreas Finne <a_finne@hotmail.com>
To: <assembly-86@lists.ticalc.org>
Sent: Wednesday, January 27, 1999 7:18 AM
Subject: Re: A86: Question on tile maps


>
>>From: BlAsTo1414@aol.com
>>Date: Tue, 26 Jan 1999 22:28:35 EST
>>To: assembly-86@lists.ticalc.org
>>Subject: Re: A86: Question on tile maps
>>Reply-To: assembly-86@lists.ticalc.org
>
>>How would I make a map(for a game like Chips Challenge{tiles also})
>>print it to the screen and move a sprite over top of it?
>>I also need to know how to check for collisions with other spites.
>>ANY help on ANY of these
>>questions would be appreciated SO much.  :-)
>>
>>Thank you,
>>BlAsTo1414
>>
>
>To put a moveable sprite on top of other sprites without destroying the
>background i suggest Jimmy Mardell's ASCR (ascr.h came with SQRXZ). It
>saves the background so it doesn't get destroyed.
>
>Andreas Finne
>
>a_finne@hotmail.com
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>
>



Follow-Ups: