07-30-2004, 03:41 AM
Hi!
After reading an old tutorial by Eclipzer I found on my HD, and studying Toshi's floormapper code I made a simple and slow floormapper, use A,Z to adjust height, and use arrow keys to move around.
However I can't figure out how to make the map rotate :???: , help would be much appreciated.
/DarkShark
After reading an old tutorial by Eclipzer I found on my HD, and studying Toshi's floormapper code I made a simple and slow floormapper, use A,Z to adjust height, and use arrow keys to move around.
Code:
DEFINT A-Z
'$DYNAMIC
DIM SHARED scrnbuff(32001) AS INTEGER 'Screen buffer
CONST XCenter = 160
CONST YCenter = 100
SCREEN 13
'Read map data
DIM map(15, 15)
FOR y = 0 TO 15
FOR x = 0 TO 15
READ map(x, y)
NEXT
NEXT
'Make 3 textures
DIM tex(2, 15, 15)
FOR n = 0 TO 2
FOR y = 0 TO 15
FOR x = 0 TO 15
tex(n, x, y) = x XOR y + 16 * (n + 1)
NEXT
NEXT
NEXT
h = -20
d = 256
uoff = 128
DEF SEG = VARSEG(scrnbuff(0)) 'Make sure I poke to the
'buffer
DO
k$ = INKEY$
REDIM scrnbuff(32001) AS INTEGER '|CLS
scrnbuff(0) = 2560 'Set buffer length (320 * 8) '|
scrnbuff(1) = 200 'Set buffer height '|
'Do keyboard stuff
xkey = INP(&H60)
clearbuffer$ = INKEY$
'
IF xkey = 30 THEN h = h - 1 'Z
IF xkey = 44 AND h - 1 < 0 THEN h = h + 1 'A
IF xkey = &H48 THEN voff = voff + 1
IF xkey = &H50 THEN voff = voff - 1
IF xkey = &H4B THEN uoff = uoff - 1
IF xkey = &H4D THEN uoff = uoff + 1
'Render screen
FOR y = 0 TO 99
v = d * h \ (h - y) + voff
FOR x = 0 TO 319
u = (x - XCenter) * h \ (h - y) + uoff
mapx = ABS((u \ 16) MOD 16)
mapy = ABS((v \ 16) MOD 16)
tile = map(mapx, mapy)
POKE (y + YCenter) * 320& + 4 + x, tex(tile, u AND 15, v AND 15)
NEXT
NEXT
WAIT &H3DA, 8: WAIT &H3DA, 8, 8
PUT (0, 0), scrnbuff(0), PSET
LOOP UNTIL k$ = CHR$(27)
END
'Map data
DATA 2,2,2,2,2,2,1,0,0,1,2,2,2,2,2,2
DATA 2,2,2,2,2,2,1,0,0,1,2,2,2,2,2,2
DATA 2,2,2,2,2,2,1,0,0,1,2,2,2,2,2,2
DATA 2,2,2,2,2,2,1,0,0,1,2,2,2,2,2,2
DATA 2,2,2,2,2,1,1,0,0,1,1,2,2,2,2,2
DATA 2,2,2,2,1,1,1,0,0,1,1,1,2,2,2,2
DATA 1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0
DATA 1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1
DATA 2,2,2,2,1,1,1,0,0,1,1,1,2,2,2,2
DATA 2,2,2,2,1,1,1,0,0,1,1,2,2,2,2,2
DATA 2,2,2,2,2,2,1,0,0,1,2,2,2,2,2,2
DATA 2,2,2,2,2,2,1,0,0,1,2,2,2,2,2,2
DATA 2,2,2,2,2,2,1,0,0,1,2,2,2,2,2,2
DATA 2,2,2,2,2,2,1,0,0,1,2,2,2,2,2,2
However I can't figure out how to make the map rotate :???: , help would be much appreciated.
/DarkShark