Jump to content



Photo
- - - - -

Optimize This Short Code


  • Please log in to reply
No replies to this topic

#1 Somelauw

Somelauw

    Newbie

  • Members
  • Pip
  • 14 posts

  • Calculators:
    Casio CFX-9850GC PLUS

Posted 08 September 2008 - 03:50 PM

Is there a faster way for the following code.
It has to be as fast as possible:

Getkey
If Ans = 27 Or Ans = 38
	 Then (ans = 27) - (Ans = 38) --> H
	 0 --> V
IfEnd
If Ans = 37 Or Ans = 28
	  Then (ans = 37) - (Ans = 28) --> V
	  0 --> H
 IfEnd

I have created a snake game.
H and V mean horizontal speed and vertical speed.
I want the code to be executed as fast as possible.

Keep in account that the keys aren't pressed all the time. The code also has to work and has to do exactly the same as it does now.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users