www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/01/14:07:56

Message-ID: <001a01bda51b$07837e40$624d08c3@arthur>
From: "Arthur" <arfa AT clara DOT net>
To: "DJGPP Mailing List" <djgpp AT delorie DOT com>
Subject: Re: scrolling with allegro
Date: Wed, 1 Jul 1998 17:11:58 +0100
MIME-Version: 1.0

>> One scheme is to create a very large bitmap object that is your level,
>> and then blit the appropriate piece onto the screen.
>> --
>
>Well that is not memory efficient, but the easiest approach.


Not memory efficient. Hmm. Let me see: for a 1600x1600 map (for instance) in
256 colours - that's 625Mb of ram. (!)

Use the tile method. Get a load of sprites which define the landscape (you
can use the same sprite on many different parts of the landscape). Define an
array for your map. If your tiles are 32x32 pixels in size, and you have a
maximum of 255 tiles, then your array needs to be 50x50 bytes in size for a
1600x1600 pixel map (1600/32=50). Now all you need to do is see what sprites
defined in this array need to de drawn, and draw them on the screen in the
right place.

James Arthur
jaa AT arfa DOT clara DOT net

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019