Re: TIB: challenge
[Prev][Next][Index][Thread]
Re: TIB: challenge
I posted very fast routine to move a pixle, or a character around the screen
in December of 98. Here it is:
Philipp has the right Idea, but there is a faster way. Lets say that
you want to make a pixle move based on the arrow keys. Here is one of the
most efficient ways to do it:
10->A \
10->B *** Sets the starting cordinants
ClrDraw *** Clears the screen
Lbl T *** Defines the start of the loop
Repeat Ans *** Starts the Main loop (use Repeat its
faster)
Getkey *** Gathers keypress
End *** Checks for keypress
If Ans>25 *** Determines which secondary loop to
use
Goto B *** If Last line true, then shuttles to
loop
If Ans==24 *** Start of secondary loop
then *** If last line true, then executes
command
B-1->B *** Command
Else *** If test (If Ans==24) is false,
then executes
A-1->A *** Command
End *** Ends secondary loop
Pxlon(A,B *** updates graph
GotoT *** Returns to Main loop
Lbl B *** Defines the start of the loop
If Ans==26 *** Start of secondary loop
Then *** If last line true, then executes
command
B+1->B *** Command
Else *** If test (If Ans==24) is false,
then executes
A+1->A *** Command
End *** Ends secondary loop
Pxlon(A,B *** updates graph
Goto T *** Returns to Main loop
Note, this routine suffers from no slow down, because it doesn't jump out of
any loops.
I have a faster way, about 50% faster, but haven't released it yet. I will
when I get some time.
Josh Cunningham
_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com