Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Spyro543 on November 22, 2011, 08:00:40 pm
-
Ok, I am learning Axe! Yay! <insert applause here>
My program lets you use the arrow keys to move a circle around the screen and change its velocity!!! :w00t:
Added a cool feature!
The circle gets larger the faster it's going!
It's still a bit buggy, but here it is!
(http://i.imgur.com/yehZ3.gif)
At the end, the circle stops instantly. Do this with [DEL]. [CLEAR] exits the program.
Attached : SVELDRAW is the source, and VELOCITY is the compiled program.
Source code:
:.VELOCITY
:0→A
:0→B
:1→X
:1→Y
:While 1
:Pause 180
:If getKey(4)
:B-1→B
:End
:If getKey(1)
:B+1→B
:End
:If getKey(2)
:A-1→A
:End
:If getKey(3)
:A+1→A
:End
:If getKey(56)
:0→A
:0→B
:End
:If getKey(15)
:Return
:End
:Y+B→Y
:X+A→X
:If X>>96
:1→X
:End
:If X<<1
:96→X
:End
:If Y>>64
:1→Y
:End
:If Y<<1
:64→Y
:End
:A+B→R
:If R<<1
:If R=0
:Circle(X,Y,1)
:Else
:Circle(X,Y,‾R)
:End
:Else
:Circle(X,Y,R)
:End
:DispGraphClrDraw
:End
Optimizations, suggestions, bug reports?
-
You need to use >> for signed comparison. X>96 returns 1 when X is less than zero (since the unsigned value of a negative number is somewhere between 32,768 and 65,535). Same thing with Y.
-
/me applauds
(http://www.omnimaga.org/Themes/default/images/gpbp_arrow_up.gif)
I found that alot of my bugs were involved with that.
I changed the check for the left side of the screen to >100, but does <<1 work for that?
-
Applause! I'll look at the code.
-
(http://www.omnimaga.org/Themes/default/images/gpbp_arrow_up.gif) Great! That is an awesome start!
-
Hooray!!!!! it seems like yesterday that i was making these programs... :D
-
Added a cool feature!
The circle gets larger the faster it's going!
It's still a bit buggy, but here it is!
(http://i.imgur.com/yehZ3.gif)
At the end, the circle stops instantly. Do this with [key][DEL][/key]. [key][CLEAR][/key] exits the program.
Attached : SVELDRAW is the source, and VELOCITY is the compiled program.
Source code:
:.VELOCITY
:0→A
:0→B
:1→X
:1→Y
:While 1
:Pause 180
:If getKey(4)
:B-1→B
:End
:If getKey(1)
:B+1→B
:End
:If getKey(2)
:A-1→A
:End
:If getKey(3)
:A+1→A
:End
:If getKey(56)
:0→A
:0→B
:End
:If getKey(15)
:Return
:End
:Y+B→Y
:X+A→X
:If X>>96
:1→X
:End
:If X<<1
:96→X
:End
:If Y>>64
:1→Y
:End
:If Y<<1
:64→Y
:End
:A+B→R
:If R<<1
:If R=0
:Circle(X,Y,1)
:Else
:Circle(X,Y,‾R)
:End
:Else
:Circle(X,Y,R)
:End
:DispGraphClrDraw
:End
Optimizations, suggestions, bug reports?
-
Optimizations:
:0→A
:0→B
:1→X
:1→Y
Can be 1 line. It optimizes to
:0->A->B+1->X->Y
Instead of doing
A+1->A and
A-1->A,
Use
A++ and
A--
Instead of
If R=0
Use
!If R
And do you need the >>
When seeing if its greater than 96 and 64?
I don't think its needed but I might be wrong because I'm not experienced with them since I just figured out they existed yesterday :P
-
That looks really cool. I like how the circle gets bigger with its velocity; it's a cool effect.
Great job on your first Axe program. ;D
-
I had countless problems getting it work (especially if I moved up or left or stood still the circle changed into this huge X thing :O) but I finally got it working! (Took a few periods in school tho :P)
-
I was programming in school before. My teacher took it away and I started freaking out. She said she thought I was doing "innapropriate things" because of my "over-the-top reaction" :P
-
I was programming in school before. My teacher took it away and I started freaking out. She said she thought I was doing "innapropriate things" because of my "over-the-top reaction" :P
is that even possible on a calc?
-
That's exactly what I was thinking when she said that.
-
That sucks. Oh well, teachers are hardly ever appreciating or even acknowledging calculator program.
-
I turned the velocity program into some fun bouncy program :D
Attached is a screenshot, SVELDRAW (source), and BOUNCE (executable). Press [CLEAR] to exit, [DEL] to reset the velocity, and arrow keys to move the ball.
That sucks. Oh well, teachers are hardly ever appreciating or even acknowledging calculator program.
Well, I showed this program to my science teacher, and he really liked it (both the program and that I'm interested in physics.)