View Single Post
Old 23 May 2011, 05:44   #16
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,188
This one loads a Tome formatted tile map and displays it...without using the Tome commands because they're just too slow. BTW, I didn't check the code or try to run it so there may still be mistakes in it.

Code:
Screen Open 1, 672, 256, 32, lowres
Flash off
Curs off
Cls 0
Load "tilemap.abk",6: Rem Load the map
Load "tiles.abk",2: Rem load the tile images as an icon bank
Get Icon Palette
Rem get size of map from tilemap.abk
T=Start(6)
MAXX=Deek(T)
MAXY=Deek(T+2)

Rem Draw the initial map starting at top left
Screen Hide
For Y=0 to 256 Step 16
  ROW=Y*MAXX+4+T : Rem add 4 to skip size header
  For X=16 to 336 Step 16
    Paste Icon X,Y,Peek(ROW+X/16)
  Next X
Next Y
Screen Show

Rem Scroll right until you get to the end of the map
MAXXP=MAXX*16-320 : Rem Maximum pixel coordinate
For X=0 to MAXXP
  LX = X mod 320
  Y=X and 15 : Rem Pixel offset and tile row
  If Y=0
    Rem This code is only accessed on even multiples of 16 pixels
    X1=LX
    X2=X1+336 : Rem 336=320+16
    COL1=X/16+T+4
    COL2=COL1+21 : Rem 21=336/16
  Endif
  YT=Y*16
  ROW=Y*MAXX
  Rem If you scroll faster than 1 pixel per frame
  Rem then you have to plot that many more tiles
  Paste Icon X1, YT, Peek(COL1+ROW)
  Paste Icon X2, YT, Peek(COL2+ROW)
  Wait Vbl
  Screen Offset LX+16, 0
Next X
Screen Close 1
Samurai_Crow is offline  
 
Page generated in 0.04260 seconds with 11 queries