Warning: Contains walls of text

A game where you "dash" in a direction until you hit a wall, the goal is to get to the P (it's a flag), while avoiding X's. It still needs a "story" and some levels.

Any optimizations would be appreciated :)

prgmDASH is just the menu's, prgmZDASH is the main game code.

Source Code:

prgmDASH:

```
Lbl M
ClrHome
Menu("DASH","New Game",N,"Level Select",L,"Quit",QT
Lbl N
1->dim(|LDASH
Pause "Story
Goto 1
Lbl L
Menu("Levels Unlocked: "+toString(dim(|LDASH)),"1",1,"2",2
Lbl 1
1->L
1->X
1->Y
DelVar [A]{26,10->dim([A]
1->[A](5,1
1->[A](1,3
1->[A](3,2
2->[A](25,9
prgmZDASH
If Ans:Goto M
Lbl 2
If dim(|LDASH)>=2:Then
2->L
prgmZDASH
Else
Pause "Level Locked
Goto M
End
If Ans:Goto M
Disp "You Beat The Game
"Quit
Lbl QT
ClrHome
"
```

prgmZDASH:

```
"Game Code
Lbl ML
DelVar DClrHome
X->S
Y->T
"Render the matrix
For(B,1,10)
For(A,1,26)
"
If [A](A,B)=1:"O
If [A](A,B)=2:"P
If [A](A,B)=3:"X
Output(B,A,Ans
End
End
"Main Loop
While 1
Output(Y,X,"theta
X->S:Y->T
"Set direction based on input
getKey->A
If D=0:Then
If Ans=24:4->D
If A=25:1->D
If A=26:2->D
If A=34:3->D
End
"Move the player
If D=1:Y-1->Y
If D=2:X+1->X
If D=3:Y+1->Y
If D=4:X-1->X
"Wall detection
If X=27 or X=0 or Y=0 or Y=11:Then
S->X:T->Y:0->D
Else
If [A](X,Y)=1:Then
S->X:T->Y:0->D
End
End
If [A](X,Y)=3:Then
Goto ML
End
If [A](X,Y)=2:Then
ClrHome
Pause "You Win
If L=dim(|LDASH:L+1->dim(|LDASH:
Menu("","Next Level",NL,"Main Menu",MM,"Quit",QT
Lbl NL:0:Return
Lbl MM:1:Return
End
"Make a wall behind the player
If D:1->[A](X,Y
End
Lbl QT
ClrHome
Stop
```

Bonus, a level editor I whipped up (1=wall, 2=Goal, 3=Spike, second sets spawn, clear quits)

```
1->X
1->Y
X->S
Y->T
DelVar [A]{26,10->dim([A]
ClrHome
For(B,1,10)
For(A,1,26)
Output(B,A,[A](A,B)
End
End
While 1
getKey->A
If Ans
Output(Y,X,[A](X,Y
min(10,max(1,Y+sum(DeltaList(Ans={25,34->Y
min(26,max(1,X+sum(DeltaList(A={24,26->X
Output(Y,Ans,"*
If A=102:0->[A](X,Y
If A=92:1->[A](X,Y
If A=93:2->[A](X,Y
If A=94:3->[A](X,Y
If A=21:Then
X->S
Y->T
End
If A=45:Stop
End
```