here is an ascii raycaster with texture mapping for anyone who wants to make a 3d game with it.

Cheers, Matt:)

' Ascii Ray Caster with texture mapping

' Using Integer Mathematics for speed Clu 5-7-03 Qbasic 1.1

'

DEFINT A-Z: DIM l(16, 16), c(360), s(360), t(16, 16)

FOR y = 1 TO 16

READ l$

FOR x = 1 TO 16

l(x, y) = VAL(MID$(l$, x, 1))

NEXT x

NEXT y

FOR y = 1 TO 16

READ l$

FOR x = 1 TO 16

t(x - 1, y) = VAL(MID$(l$, x, 1))

NEXT x

NEXT y

FOR t = 0 TO 360

s(t) = 100 * SIN(22 / 7 * t / 180)

c(t) = 100 * COS(22 / 7 * t / 180)

NEXT t

x = 5600: y = 4000: f = 0: SCREEN 0: WIDTH 80, 50

DEF SEG = &HB800

main:

FOR s = -40 TO 39: a$ = INKEY$

r = f + (s * 60 \ 80): r = r + 360 * ((r > 360) - (r < 0))

r = r - (c(r) = 0): xi = c(r): yi = s(r): x1 = x: y1 = y:

wallcheck:

x1 = x1 + xi: y1 = y1 + yi

IF l(x1 \ 1600, y1 \ 1600) = 0 THEN GOTO wallcheck

xint = ABS(x1 - INT((x1 + 800) \ 1600) * 1600)

yint = ABS(y1 - INT((y1 + 800) \ 1600) * 1600)

IF xint > yint THEN tc = (x1 - (((x1 \ 1600)) * 1600)) \ 100

IF yint > xint THEN tc = (y1 - (((y1 \ 1600)) * 1600)) \ 100

d = (ABS((x - x1) \ c(r)) * c(ABS(r - f))) * .01

h = (69 * 16 \ d) \ 2

FOR ys = 0 TO 49

addr = (s + 40) * 2 + (ys * 160): POKE addr, 178

IF ys > 25 - h AND ys < 25 + h THEN POKE addr + 1, t(tc, INT(ys - (25 - h)) / (h * 2) * 16)

IF ys > 24 + h THEN POKE addr + 1, 2

IF ys <= 26 - h THEN POKE addr + 1, 9

NEXT ys

NEXT s

k = INP(96): f = f + 5 * (k = 75) - 5 * (k = 77)

f = f - 355 * (f = -5) + 360 * (f = 365)

dx = c(f) * (-(k = 72) + (k = 80)): dy = s(f) * (-(k = 72) + (k = 80))

IF l((x + dx) \ 1600, (y + dy) \ 1600) = 0 THEN x = x + dx: y = y + dy

IF INP(96) = 1 THEN SYSTEM ELSE GOTO main

DATA "1111111111111111"

DATA "1000010000010011"

DATA "1000000111110001"

DATA "1000010010000001"

DATA "1111111010000001"

DATA "1000001011101111"

DATA "1000001000000001"

DATA "1000000011100001"

DATA "1000001010000001"

DATA "1111111011100111"

DATA "1000001000000001"

DATA "1000101101001001"

DATA "1000000101011101"

DATA "1001000000001001"

DATA "1000000100000001"

DATA "1111111111111111"

DATA "8666666686666666"

DATA "8666666686666666"

DATA "8666666686666666"

DATA "8888888888888888"

DATA "6666866666668666"

DATA "6666866666668666"

DATA "6666866666668666"

DATA "8888888888888888"

DATA "8666666686666666"

DATA "8666666686666666"

DATA "8666666686666666"

DATA "8888888888888888"

DATA "6666866666668666"

DATA "6666866666668666"

DATA "6666866666668666"

DATA "8888888888888888"