TIB: Re: (86 Basic) Please help
[Prev][Next][Index][Thread]
TIB: Re: (86 Basic) Please help
First, replace all of the "Else"
commands with "End" commands. I don't see a need for
"Else" in this code, and it seems your if-then statements are nested
really bad.
Plus, I think for optimization, leave out the "Goto
TOP" after each "@Move"--it's not neccesary and just put one
"Return" at the end of all the If-Then statements. In addition,
use the getky scheme that was discussed earlier on the list--it was agreed to be
the fastest getky routine. Here is a revised code:
:Outpt(Y,X,Q
:Lbl TOP
:Repeat Ans
:getKy
:End
:If Ans==24 or Ans==25 or Ans==26 or
Ans==34
:Then
:Outpt(Y,X,SP
:(Ans==26)(X<20) - (Ans==24)(X>2)+X (=>)
X
:(Ans==34)(Y<7) - (Ans==25)(Y>2)+Y (=>)
Y
:Outpt(Y,X,Q
:End
:Goto TOP
I redid the @Move subroutine to mathematically update X and Y instead of
using If-Then statements, making it go faster. Then I put the
@Move subroutine into the main code since it's short enough.
Hope this helps. (I haven't tried it but it should work)
~Dave <the_regul8r@bigfoot.com>
==========================
I don't understand why this doesn't work! the movement works fine,
but
whenever I try to test the my prevention from going off screen,
it
freezes. I can still quit via On, but none of the keys respond any
more.
Any help?
The program has a subroutine for movent.
The main prog (part of it
anyways)
:Outpt(Y,X,Q
:Lbl TOP
:getKy(=>)A
:If A==24 or
A==25
:Then
:@Move
:Goto TOP
:Else
:If A==26 or
A==34
:Then
:@Move
:Goto TOP
:Else
:Goto TOP
the @move
subroutine
:Lbl TOP
:If A==24 and
X>2
:Then
:Outpt(Y,X,SP
:X-1(=>)X
:Outpt(Y,X,Q
:Return
:Else
:If
A==26 and
X<20
:Then
:Outpt(Y,X,SP
:X+1(=>)X
:Outpt(Y,X,Q
:Return
:Else
:If
A==25 and
Y>2
:Then
:Outpt(Y,X,SP
:Y-1(=>)Y
:Outpt(Y,X,Q
:Return
:Else
:If
A==34 and
Y<7
:Then
:Outpt(Y,X,SP
:Y+1(=>)Y
:Outpt(Y,X,Q
:Return
:Else
:Goto
TOP
Follow-Ups: