I wrote this really basic engine for platformers in BASIC that spans two screens. It doesn't use any pictures, but it does use 3 lists, one for each screen (contains all the pixels) and one that's for misc variables, but as of now only contains the starting position. It runs pretty slowly though, and I'm not good at optimization..
PS: I know that there's a memory leak, but it sped it up a lot.
Code for engine:
:0→O
:∟ENG(1)→D
:ClrDraw
:For(X,1,dim(∟P1))
:If ∟P1(X)
:Pxl-On(100fPart(∟P1(X)),int(∟P1(X)))
:End
:int(D)→X
:100fPart(D)→Y
:0→S
:Lbl 1
:S+1→S
:Text(1,1,S)
:getKey→G
:Pxl-On(Y,X)
:Pxl-On(Y,X+1)
:Pxl-On(Y-1,X+1)
:Pxl-On(Y-1,X)
:X→A
:Y→B
:If X≥4:Then
:If G=24 and not((pxl-Test(Y,X-1) or pxl-Test(Y-1,X-1)) or (pxl-Test(Y,X-2) or pxl-Test(Y-1,X-2)):Then
:X-2→X
:Goto 0
:End
:End
:If X≤90:Then
:If G=26 and not((pxl-Test(Y,X+2) or pxl-Test(Y-1,X+2)) or (pxl-Test(Y,X+3) or pxl-Test(Y-1,X+3)):Then
:X+2→X
:Goto 0
:End
:End
:
:If ((not(pxl-Test(Y-2,X) or pxl-Test(Y-3,X))) and G=25) and ((pxl-Test(Y+1,X) or pxl-Test(Y+1,X+1)):Then
:O-3→O
:Goto 0
:End
:If X≤91:Then
:If (((G=26 and (pxl-Test(Y,X+2) and pxl-Test(Y+1,X+2)) and not(pxl-Test(Y-1,X+2)))):Then
:X+1→X
:Y-1→Y
:Goto 0
:Else
:If G=26 and pxl-Test(Y,X+3):Then
:X+1→X
:Goto 0
:End
:End
:End
:If X≥2:Then
:If ((G=24) and (pxl-Test(Y,X-1) and pxl-Test(Y+1,X-1))) and not(pxl-Test(Y-1,X-1)):Then
:Y-1→Y
:X-1→X
:Goto 0
:Else
:If G=24 and pxl-Test(Y,X-2):Then
:X-1→X
:Goto 0
:End
:End
:End
:Lbl 0
:If (not((pxl-Test(Y+1,X) or pxl-Test(Y+1,X+1)):Then
:Y+1→Y
:If O<0
:O+1→O
:End
:
:If X≤4:Then
:Y→E
:ClrDraw
:E→Y
:For(X,1,dim(∟P1))
:If ∟P1(X)
:Pxl-On(100fPart(∟P1(X)),int(∟P1(X)))
:End
:90→X
:End
:If X≥91:Then
:Y→E
:ClrDraw
:For(X,1,dim(∟P2))
:If ∟P2(X)
:Pxl-On(100fPart(∟P2(X)),int(∟P2(X)))
:End
:E→Y
:5→X
:End
:O+Y→Y
:Pxl-Off(B,A)
:Pxl-Off(B,A+1)
:Pxl-Off(B-1,A+1)
:Pxl-Off(B-1,A)
:Goto 1
Generated by SourceCoder (http://sc.cemetech.net)
© 2005-2010 Cemetech (http://www.cemetech.net)
Code for routine that takes pic1 and pic2 and stores them into the lists the program uses (lP1 and lP2):
:ClrDraw
:RecallPic Pic1
:1→S
:For(X,1,94)
:For(Y,1,62)
:If pxl-Test(Y,X):Then
:S+1→dim(∟P1)
:(X+(Y/100))→∟P1(S)
:S+1→S
:End
:Output(8,int(X/12)+1,"*")
:End
:End
:ClrDraw
:RecallPic Pic2
:1→S
:For(X,1,94)
:For(Y,1,62)
:If pxl-Test(Y,X):Then
:S+1→dim(∟P2)
:(X+(Y/100))→∟P2(S)
:S+1→S
:End
:Output(8,int(X/12)+8,"*")
:End
:End
Generated by SourceCoder (http://sc.cemetech.net)
© 2005-2010 Cemetech (http://www.cemetech.net)