Here's a snippet of code from one of my programs:
Code:
The K=21 bit hasn't been added yet, but it shouldn't matter for this question.
What this is supposed to do is move a little box around the screen depending on which arrow keys one presses. The problem is: it's not. It starts off by displaying the box, but when any arrow key is pressed, the box disappears. The 2nd key just clears the screen and redraws everything that was there before, as expected. There is a picture variable (Pic6) accompanying it.
Any ideas? This used to work, but I made a few changes and it no longer does.
Code:
SetUpEditor |LHST
SetUpEditor |LPOS
0->Xmin
~62->Ymin
94->Xmax
0->Ymax
1->N
ClrDraw
ClrHome
1->G
~1->H
45->I
Lbl MN
Line(G,H,I,H
Line(I,H,I,H-28
Line(I,H-28,G,H-28
Line(G,H-28,G,H
RecallPic 6
Repeat K=21 or K=24 or K=25 or K=26 or K=34
getKey->K
End
If K=24
Then
If G=1 and (H=~1 or H=~33
Goto MN
Else
G-48->G
I-48->I
End
If K=25
Then
If H=~1 and (G=1 or G=49
Goto MN
Else
H+32->H
End
If K=26
Then
If G=49 and (H=~1 or H=~33
Goto MN
Else
G+48->G
I+48->I
End
If K=34
Then
If H=~33 and (G=1 or G=49
Goto MN
Else
H-32->H
End
ClrDraw
Goto MN
The K=21 bit hasn't been added yet, but it shouldn't matter for this question.
What this is supposed to do is move a little box around the screen depending on which arrow keys one presses. The problem is: it's not. It starts off by displaying the box, but when any arrow key is pressed, the box disappears. The 2nd key just clears the screen and redraws everything that was there before, as expected. There is a picture variable (Pic6) accompanying it.
Any ideas? This used to work, but I made a few changes and it no longer does.