Lesson 1:


4-way scrolling



First off, the code!

prgmRUN:
:" ->Str3
:11->θ
:prgmMAP
:Str2->Str1
:Output(1,1,Str1
:2->C
:2->D
:1->E
:18->F
:Repeat X=45
:Output(C,D,sub"^>v<",E,1
:(C-1)16+D->F
:Repeat Ans
:getKey
:End
:Ans->X
:Output(C,D,sub(Str1,F,1 :D+(X=26 and inString(Str3,sub(Str1,F+1,1)))-(X=24 and inString(Str3,subStr1,F-1,1->D :C+(X=34 and inString(Str3,sub(Str1,F+16,1)))-(X=25 and inString(Str3,sub(Str1,F-16,1->C :(X=25)+2(X=26)+3(X=34)+4(X=24->G :If G:G->E :If C=8 or C=1 or D=1 or D=16 :Then :prgmMAPSC :Output(1,1,Str1 :End :End


prgmMAPSC:
:If C=1
:Then
:θ-10->θ
:prgmMAP
:For(X,2,8
:Output(X,1,Str1
:Output(X,D,"^
:Output(1,1,sub(Str2,(9-X)16-15,(X-1)16
:End
:Str2->Str1
:7->C
:End
:If C=8
:Then
:θ+10->θ
:prgmMAP
:For(X,8,2,-1
:Output(X,1,Str2
:Output(X,D,"v
:Output(1,1,sub(Str1,(9-X)16+1,(X-1)16
:End
:Str2->Str1
:2->C
:End
:If D=1
:Then
:θ-1->θ
:prmgMAP
:For(X,1,15,2
:Output(1,1,sub(Str2,17-X,X)+sub(Str1,1,16-X)+sub(Str2,2(16)+1-X,X)+sub(Str1,17,16-X)+sub(Str2,3(16)+1-X,X)+sub(Str1,2(16)+1,16-X)+sub(Str2,4(16)+1-X,X)+sub(Str1,3(16)+1,16-X)+sub(Str2,5(16)+1-X,X)+sub(Str1,4(16)+1,16-X)+sub(Str2,6(16)+1-X,X)+sub(Str1,5(16)+1,16-X)+sub(Str2,7(16)+1-X,X)+sub(Str1,6(16)+1,16-X)+sub(Str2,8(16)+1-X,X)+sub(Str1,7(16)+1,16-X
:Output(C,X+1,"<
:End
:Str2->Str1
:15->D
:End
:If D=16
:Then
:θ+1->θ
:prgmMAP
:For(X,15,1,-2
:Output(1,1,sub(Str1,17-X,X)+sub(Str2,1,16-X)+sub(Str1,2(16)+1-X,X)+sub(Str2,17,16-X)+sub(Str1,3(16)+1-X,X)+sub(Str2,2(16)+1,16-X)+sub(Str1,4(16)+1-X,X)+sub(Str2,3(16)+1,16-X)+sub(Str1,5(16)+1-X,X)+sub(Str2,4(16)+1,16-X)+sub(Str1,6(16)+1-X,X)+sub(Str2,5(16)+1,16-X)+sub(Str1,7(16)+1-X,X)+sub(Str2,6(16)+1,16-X)+sub(Str1,8(16)+1-X,X)+sub(Str2,7(16)+1,16-X
:Output(C,X,">
:End
:Str2->Str1
:2->D
:End

prgmMAP:

:If θ=11
:"OOOOOOO  OOOOOOOO              OO              O                                O              OO              OOOOOOOO  OOOOOOO
:If θ=1
:"OOOOOOOOOOOOOOOOO              OO              OO              OO              OO              OO              OOOOOOOO  OOOOOOO
:If θ=21
:"OOOOOOO  OOOOOOOO              OO              OO              OO              OO              OO              OOOOOOOOOOOOOOOOO
:If θ=10
:"OOOOOOOOOOOOOOOOO              OO              OO               O               O              OO              OOOOOOOOOOOOOOOOO
:If θ=12
:"OOOOOOOOOOOOOOOOO              OO              O               O               OO              OO              OOOOOOOOOOOOOOOOO
Ans->Str2


That's it... you run "prgmRUN" to start, and keep adding maps to "prgmMAP" to have more maps, and add all non-solid things to Str3 and you're good! Basically what this does is mimmic xLIB in the spritemap dept. and the reason that the side<->side scrolling is by 2 is because it is horribly slow on the norm 83+ :( darn!


This tutorial by CDI. Questions can be directed to him at the forums.

Back to Main