I was bored the other day so I started making a small flea game (I remember it from when I played Runescape, it was one of the Jagex games) and I decided I needed a drawing routine to use for drawing walls while the fleas are moving (I will try to have that up tomorrow or the next day)
Here is a version of it that I made for testing, tell me if you see any optimizations or errors (besides the extra parenthesis in the pxl-on, I know =P
The program starts at 0,0 and from there it uses the keynumbers 51-95 to draw in a 5-by-5 square that you move with the arrow keys (put it in your calculator and try it out =D)
I is the x axis
J is the y axis
K is the input
Code:
Here is my favorite line
Code:
Code:
determines the 10's place (so from 5-9 for this)
Code:
determines the 1's place (from 1-5 for this)
I am almost 100% sure that it is faster and more optimized than using a bunch of if statements to find the key that was pressed and respond to it.
Here is a version of it that I made for testing, tell me if you see any optimizations or errors (besides the extra parenthesis in the pxl-on, I know =P
The program starts at 0,0 and from there it uses the keynumbers 51-95 to draw in a 5-by-5 square that you move with the arrow keys (put it in your calculator and try it out =D)
I is the x axis
J is the y axis
K is the input
Code:
:DelVar IDelVar KWhile 1
:getKey→K
:If Ans>50 and Ans<100
:Pxl-Change(I5-5+(round((K-1)/10,0)),(J5-5+(fPart(K/10)10-1
:J-(K=24)1→J
:I-(K=25)1→I
:J+(K=26)1→J
:I+(K=34)1→I
:If I=‾1:11→I
:If I=12:DelVar IIf J=0:18→J
:If J=19:1→J
:End
Generated by SourceCoder (http://www.cemetech.net/projects/basicelite/sourcecoder.php)
© 2005 Cemetech (http://www.cemetech.net)
(Don't worry Kerm, I didn't leave it out =D)
Here is my favorite line
Code:
:Pxl-Change(I5-5+(round((K-1)/10,0)),(J5-5+(fPart(K/10)10-1
Code:
(round((K-1)/10,0))
Code:
(fPart(K/10)10-1)
I am almost 100% sure that it is faster and more optimized than using a bunch of if statements to find the key that was pressed and respond to it.