The first game I ever wrote from scratch was in QB with a friend. We were loading in .gifs with this cool function some guy wrote and using it to load in pictures of views in a maze you could walk around. We wanted to have enemies you could shoot with a laser beam (a blue line that drew from the mid bottom of the screen to the middle of the screen for a second).
We used to really suck. I mean, not even like regular suck, I mean major suck. Completely doing everything wrong.
DECLARE SUB LoadGif (Giffilename$, DelayTime!)
SCREEN 12
DO
CLS
LET FileName$ = "Room1.gif"
LET DelayTime! = 1
LoadGif FileName$, DelayTime!
SLEEP
LOOP UNTIL press$ = "8" OR INKEY$ = "4" OR INKEY$ = "6" OR INKEY$ = "2"
IF press$ = "6" THEN GOTO 112:
END
IF press$ = "4" THEN GOTO 221:
END
IF press$ = "8" THEN GOTO 331:
END
IF press$ = "2" THEN GOTO 113:
END
112 :
DO
CLS
LET FileName$ = "Room4.gif"
LET DelayTime! = 1
LoadGif FileName$, DelayTime!
SLEEP
LOOP UNTIL press$ = "8" OR INKEY$ = "4" OR INKEY$ = "6" OR INKEY$ = "2"
221 :
DO
CLS
LET FileName$ = "Room3.gif"
LET DelayTime! = 1
LoadGif FileName$, DelayTime!
SLEEP
LOOP UNTIL press$ = "8" OR INKEY$ = "4" OR INKEY$ = "6" OR INKEY$ = "2"
331 :
DO
CLS
LET FileName$ = "Room1.gif"
LET DelayTime! = 1
LoadGif FileName$, DelayTime!
SLEEP
LOOP UNTIL press$ = "8" OR INKEY$ = "4" OR INKEY$ = "6" OR INKEY$ = "2"
END
113 :
DO
CLS
LET FileName$ = "Room2.gif"
LET DelayTime! = 1
LoadGif FileName$, DelayTime!
SLEEP
LOOP UNTIL press$ = "q" OR press$ = "Q"
END
DEFINT A-Z
SUB LoadGif (Giffilename$, DelayTime!)
DIM P(4095), S(4095), OS(4095), SO(8), YB AS LONG, PO2(11) AS LONG, WC AS LONG
FOR a = 0 TO 8: SO(8 - a) = 2 ^ a: NEXT
FOR a = 0 TO 11: PO2(a) = 2 ^ a: NEXT
IF INSTR(Giffilename$, ".") = 0 THEN Giffilename$ = Giffilename$ + ".GIF"
DIM a%(15): OPEN "b", FREEFILE, Giffilename$
FOR b% = 1 TO 15: GET #FREEFILE - 1, b%, a%(b%): NEXT: CLOSE FREEFILE - 1
FOR b% = 1 TO 15: IF a%(b%) <> 0 THEN tag% = tag% + 1
NEXT
IF tag% = 0 THEN PRINT "File Not Found": KILL Giffilename$: EXIT SUB
OPEN "B", FREEFILE, Giffilename$: a$ = " ": GET #FREEFILE - 1, , a$
IF LEFT$(a$, 3) <> "GIF" THEN PRINT "Not a GIF file.": CLOSE FREEFILE - 1: EXIT SUB
FOR a% = 1 TO 2: GET #FREEFILE - 1, , dummy%: NEXT: GOSUB GB
NC = 2 ^ ((a AND 7) + 1): NP = (a AND 128) = 0
GOSUB GB: BG = a: GOSUB GB
IF NP = 0 THEN P$ = SPACE$(NC * 3): GET #FREEFILE - 1, , P$
DO: DO: DO: IF EOF(1) THEN GOTO AD
GOSUB GB: LOOP WHILE a = 0
SELECT CASE a
CASE 44: EXIT DO
CASE 59: GOTO AD
CASE IS <> 33: PRINT "Unknown GIF extension type.": CLOSE FREEFILE - 1: EXIT SUB
END SELECT
GOSUB GB
DO: GOSUB GB: a$ = SPACE$(a): GET #1, , a$: LOOP UNTIL a = 0: LOOP
GET #FREEFILE - 1, , XS: GET #FREEFILE - 1, , YS: GET #FREEFILE - 1, , XL
GET #FREEFILE - 1, , YL: XE = XS + XL: YE = YS + YL: GOSUB GB
IF (a AND 128) THEN NP = 0: NC = 2 ^ ((a AND 7) + 1): P$ = SPACE$(NC * 3): GET #1, , P$
IL = (a AND 64) > 0: PN = 0: PS = 8: GOSUB GB
CC = 2 ^ a: EOSC = CC + 1: FC = CC + 2: NXC = FC: SCS = a + 1: CS = SCS
SMC = 2 ^ (a + 1) - 1: MC = SMC: BI = 0: BS = 0: BP = 1: x = XS: y = YS
YB = y * 320&
IF FT = 0 THEN SCREEN 13: DEF SEG = &HA000
IF NP = 0 THEN OUT &H3C8, 0: FOR a = 1 TO NC * 3: OUT &H3C9, ASC(MID$(P$, a, 1)) \ 4: NEXT
IF FT = 0 THEN FT = -1
DO: GOSUB GC
IF c <> EOSC THEN
IF c = CC THEN
NXC = FC: CS = SCS: MC = SMC
DO: GOSUB GC: LOOP WHILE c = CC
IF c = EOSC THEN GOTO ID
LC = c: LP = c
IF x < 320 AND y < 200 THEN POKE x + YB, LP
'
IF x = 0 AND y = 0 THEN 'if coordinates are 0, 0
IF TheGifDelayChecker% = 0 THEN GOTO NoWay 'don't delay if loading the first
'frame
t! = TIMER 'get time for delay
DO: LOOP UNTIL t! + DelayTime! < TIMER 'delay
GOTO ItWorked 'skip over the skip over part =cP
NoWay: 'the skip over part
TheGifDelayChecker% = 1 'set to not the beginning
ItWorked: 'skip the skip to here
'
END IF
x = x + 1: IF x = XE THEN GOSUB NSL
ELSE
CRC = c: SP = 0
IF c >= NXC THEN
IF c > NXC THEN GOTO AD
CRC = LC: OS(SP) = LP: SP = SP + 1
END IF
DO WHILE CRC >= FC: OS(SP) = S(CRC): SP = SP + 1: CRC = P(CRC): LOOP: LP = CRC
IF x < 320 AND y < 200 THEN POKE x + YB, LP
x = x + 1: IF x = XE THEN GOSUB NSL
FOR a = SP - 1 TO 0 STEP -1
IF x < 320 AND y < 200 THEN POKE x + YB, OS(a)
x = x + 1: IF x = XE THEN GOSUB NSL
NEXT
IF NXC < 4096 THEN
P(NXC) = LC: S(NXC) = LP: NXC = NXC + 1
IF (NXC > MC) AND (CS < 12) THEN
CS = CS + 1: MC = MC * 2 + 1
END IF
END IF
LC = c
END IF
END IF
LOOP UNTIL c = EOSC
ID: LOOP
AD: CLOSE FREEFILE - 1: EXIT SUB
GB: a$ = " ": GET #FREEFILE - 1, , a$: a = ASC(a$): RETURN
NSL: IF IL THEN
y = y + PS
IF y >= YE THEN
PN = PN + 1
SELECT CASE PN
CASE 1: y = 4: PS = 8
CASE 2: y = 2: PS = 4
CASE 3: y = 1: PS = 2
END SELECT
END IF
ELSE
y = y + 1
END IF
x = XS: YB = y * 320&
RETURN
GC: WC = LCR \ SO(BI): DO WHILE CS > BI
IF BP > BS THEN
GOSUB GB: BS = a: a$ = SPACE$(BS): GET #FREEFILE - 1, , a$
BP = 1
END IF
LCR = ASC(MID$(a$, BP, 1)): BP = BP + 1
WC = WC OR LCR * PO2(BI): BI = BI + 8: LOOP
BI = BI - CS: c = WC AND MC: RETURN
END SUB
I'm going to eat you!