- [Prizm] Scrolling Map engine using strings
- 26 Oct 2011 06:27:58 pm
- Last edited by Sarah on 27 Oct 2011 07:12:44 pm; edited 1 time in total
I got it to work, but it needs collision detection.
It is seemingly bug free.
Code:
Note: The map isn't rendered until after you move the first time.
Old post: When you use the LOCATE command with a String, the whole string is placed on the screen at once. Using simple equations, you could change the start of the string displayed. Combine these with 7 strings down the screen and you would not only have very fast map rendering, but you would also have easily changeable graphics on the screen. The only problem is, I don't see how collision detection would work.
However, even on a Prizm with a max String length of 255, this would increase the max size of a map from 21x7 to 255x99(Not sure about the Y coord).
It is seemingly bug free.
Code:
'ProgramMode:RUN
1->Theta
1-><r>
2->X
2->Y
5->V
5->W
"_#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5_"->Str 1
"_#E5B5_ _#E5B5_ _#E5B5_ _#E5B5_ _#E5B5_ _#E5B5_"->Str 2
"_#E5B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#E5B5_ _#E5B5__#E5B5_ _#E5B5_ _#E5B5_ _#E5B5_ _#E5B5_ _#E5B5_"->Str 19
"_#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5__#E5B5_"->Str 20
Do
While X=X
Locate 2,2,<r>+X-1
Locate 2,3,Theta+Y-1
If Getkey=28 And Y<>2
Then X->V
Y->W
If Theta<>1 And Theta<>14
Then Theta-1->Theta
Break
IfEnd
If Theta=14 And Y=4
Then Theta-1->Theta
Break
IfEnd
Theta=1 Or Theta=14=>Y-1->Y
Break
IfEnd
If Getkey=37 And Y<>6
Then X->V
Y->W
If Theta<>1 And Theta<>14
Then Theta+1->Theta
Break
IfEnd
If Theta=1 And Y=4
Then Theta+1->Theta
Break
IfEnd
Theta=1 Or Theta=14=>Y+1->Y
Break
IfEnd
If Getkey=38 And X<>2
Then X->V
Y->W
If <r><>1 And <r><>80
Then <r>-1-><r>
Break
IfEnd
If <r>=80 And X=11
Then <r>-1-><r>
Break
IfEnd
<r>=1 Or <r>=80=>X-1->X
Break
IfEnd
If Getkey=27 And X<>20
Then X->V
Y->W
If <r><>1 And <r><>80
Then <r>+1-><r>
Break
IfEnd
If <r>=1 And X=11
Then <r>+1-><r>
Break
IfEnd
<r>=1 Or <r>=80=>X+1->X
Break
IfEnd
WhileEnd
Theta=1=>Locate 1,1,StrMid(Str 1,<r>,<r>+20)
1<=Theta And Theta<=2=>Locate 1,3-Theta,StrMid(Str 2,<r>,<r>+20)
1<=Theta And Theta<=3=>Locate 1,4-Theta,StrMid(Str 3,<r>,<r>+20)
1<=Theta And Theta<=4=>Locate 1,5-Theta,StrMid(Str 4,<r>,<r>+20)
1<=Theta And Theta<=5=>Locate 1,6-Theta,StrMid(Str 5,<r>,<r>+20)
1<=Theta And Theta<=6=>Locate 1,7-Theta,StrMid(Str 6,<r>,<r>+20)
1<=Theta And Theta<=7=>Locate 1,8-Theta,StrMid(Str 7,<r>,<r>+20)
2<=Theta And Theta<=8=>Locate 1,9-Theta,StrMid(Str 8,<r>,<r>+20)
3<=Theta And Theta<=9=>Locate 1,10-Theta,StrMid(Str 9,<r>,<r>+20)
4<=Theta And Theta<=10=>Locate 1,11-Theta,StrMid(Str 10,<r>,<r>+20)
5<=Theta And Theta<=11=>Locate 1,12-Theta,StrMid(Str 11,<r>,<r>+20)
6<=Theta And Theta<=12=>Locate 1,13-Theta,StrMid(Str 12,<r>,<r>+20)
7<=Theta And Theta<=13=>Locate 1,14-Theta,StrMid(Str 13,<r>,<r>+20)
8<=Theta And Theta<=14=>Locate 1,15-Theta,StrMid(Str 14,<r>,<r>+20)
9<=Theta And Theta<=14=>Locate 1,16-Theta,StrMid(Str 15,<r>,<r>+20)
10<=Theta And Theta<=14=>Locate 1,17-Theta,StrMid(Str 16,<r>,<r>+20)
11<=Theta And Theta<=14=>Locate 1,18-Theta,StrMid(Str 17,<r>,<r>+20)
12<=Theta And Theta<=14=>Locate 1,19-Theta,StrMid(Str 18,<r>,<r>+20)
13<=Theta And Theta<=14=>Locate 1,20-Theta,StrMid(Str 19,<r>,<r>+20)
Theta=14=>Locate 1,7,StrMid(Str 20,<r>,<r>+20)
Locate V,W," "
Locate X,Y,"O"
LpWhile X=X
Note: The map isn't rendered until after you move the first time.
Old post: When you use the LOCATE command with a String, the whole string is placed on the screen at once. Using simple equations, you could change the start of the string displayed. Combine these with 7 strings down the screen and you would not only have very fast map rendering, but you would also have easily changeable graphics on the screen. The only problem is, I don't see how collision detection would work.
However, even on a Prizm with a max String length of 255, this would increase the max size of a map from 21x7 to 255x99(Not sure about the Y coord).