12123434 wrote:
Okay. This is the code for the first level and the menu:
Code: ClrHome
3→S
3→T
6→Y
8→X
1→C
0→Q
randInt(5,21)→E
randInt(2,9)→D
randInt(5,21)→G
randInt(2,9)→F
Lbl θ
Menu("LEGEND OF DOORS","START",A,"CONTROLS",C,"QUIT",B
Lbl A
Output(1,5,"SCORE:"
Output(1,12,Q
Output(1,14,"8888888888888"
Output(10,1,"88888888888888888888888888"
Output(1,1,"8888"
Output(2,1,"8888"
Output(3,1,"8888"
Output(4,1,"8888"
Output(5,1,"8888"
Output(6,1,"8888"
Output(7,1,"8888"
Output(8,1,"8888"
Output(9,1,"8888"
Output(1,23,"8888"
Output(2,23,"8888"
Output(3,23,"8888"
Output(4,23,"8888"
Output(5,23,"8888"
Output(6,23,"8888"
Output(7,23,"8888"
Output(8,23,"8888"
Output(9,23,"8888"
Output(1,12,Q
Output(Y,X,"θ"
Output(D,E,"X"
Output(F,G,"X"
Output(9,22,"O"
Output(7,10,"W"
G→U
G+1→G
If G=23
Then
5→G
End
Output(F,G,"X"
Output(F,U," "
getKey→C
If C=24
Then
X→T
X-1→X
Output(Y,T," "
End
If C=26
Then
X→T
X+1→X
Output(Y,T," "
End
If C=25
Then
Y→S
Y-1→Y
Output(S,X," "
End
If C=34
Then
Y→S
Y+1→Y
Output(S,X," "
End
If X=23
Then
22→X
End
If X=4
Then
5→X
End
If Y=10
Then
2→Y
End
If Y=1
Then
9→Y
End
If D=Y and E=X
Then
Goto θ
End
If F=Y and G=X
Then
Goto θ
End
If X=22 and Y=9
Then
prgmLOFDLVL2
End
If X=20 and Y=7
Then
S→Y
T→X
End
End
ClrHome
Lbl C
Output(1,1,"MOVE: ARROW KEYS"
Output(2,1,"YOU: θ"
Output(3,1,"ENEMIES: X"
Output(4,1,"WALLS: W"
Output(5,1,"POINTS: π"
Output(6,1,"TARGET: O"
Output(7,1,"OTHER STUFF: F,B, AND D"
Pause
ClrHome
Goto θ
Lbl B
ClrHome
I see some optimization right away:
Code: ClrHome
3→S
3→T
6→Y
8→X
1→C
0→Q
randInt(5,21→E // removed parentheses, as suggested by SM84CE
randInt(2,9→D
randInt(5,21→G
randInt(2,9→F
Lbl θ
Menu("LEGEND OF DOORS","START",A,"CONTROLS",C,"QUIT",B
Lbl A
Output(1,5,"SCORE:"
Output(1,12,Q
"8888 // as suggested by SM84CE, a shortcut for all those 8's
Output(1,14,Ans+Ans+Ans+"8 // removed closing quote, here and following lines
Output(10,1,Ans+Ans+Ans+Ans+Ans+Ans+"88
Output(1,1,Ans // despite your comment on SAX, I highly recommend you use a loop here
Output(2,1,Ans
Output(3,1,Ans
Output(4,1,Ans
Output(5,1,Ans
Output(6,1,Ans
Output(7,1,Ans
Output(8,1,Ans
Output(9,1,Ans
Output(1,23,Ans
Output(2,23,Ans
Output(3,23,Ans
Output(4,23,Ans
Output(5,23,Ans
Output(6,23,Ans
Output(7,23,Ans
Output(8,23,Ans
Output(9,23,Ans
Output(1,12,Q
Output(Y,X,"θ
Output(D,E,"X
Output(F,G,"X
Output(9,22,"O
Output(7,10,"W
G→U
G+1→G
If G=23 // if an If-block has only one line, the Then & End lines can be skipped
5→G
Output(F,G,"X
Output(F,U,"
getKey→C
If max(Ans={24,26 // Ans is a bit faster, used a trick to check if Ans is 24 or 26, combined if blocks
Then
X→T
Output(Y,T,"
End
X-(C=24)+(C=26→X // either 0 or 1 is added/subtracted, smaller and faster shortcut
If max(C={25,34
Then
Y→S
Output(S,X,"
End
Y-(C=25)+(C=34→Y
22(X=23)+5(X=4)+Xmax(X!={4,22→X // just combined those with another trick
2(Y=10)+9(Y=1)+Ymax(Y!={1,10→Y
If D=Y and E=X
Goto θ
If F=Y and G=X
Goto θ
If X=22 and Y=9
prgmLOFDLVL2
If X=20 and Y=7
Then
S→Y
T→X
End
// ??
End
ClrHome
Lbl C
Output(1,1,"MOVE: ARROW KEYS
Output(2,1,"YOU: θ
Output(3,1,"ENEMIES: X
Output(4,1,"WALLS: W
Output(5,1,"POINTS: π
Output(6,1,"TARGET: O
Output(7,1,"OTHER STUFF: F,B, AND D
Pause
ClrHome
Goto θ
Lbl B
ClrHome
Please test before running this, I made this just in the post editing window and may have typos or whatever.