Hello! I've been having some trouble getting the exit code to work in a small demo game I've been working on. Can anyone give me tips on how to resolve this? I've tried many different ways, but I admit I'm still a beginner, so maybe someone else knows more about this :)


Code:
.SHOOTER A first game to practice Axe coding.
DiagnosticOff
44->B
28->C
0->A->P->T
rand^95->D
rand^63->E
ClrHome
Disp "SHOOTER         "
Disp "PRESS ENTER"
Repeat K=9
getKey->K
End
.Game Loop code
.Sprites
[007C9292EE92927C]->Pic1
[003844BAAABA4438]->Pic2
[0000000000000000]->Pic3
[00245A85854A2418]->Pic4
.Game
Pt-On(B,C,Pic1)
sub(GM)
.Loss screen and return to TI-OS
ClrHome
Disp "YOU SHOT  TARGETS"
Pause 2500
ClrHome
Disp "SHOOTER         BY OLIENS       "
DiagnosticOn
Return
.Game subroutine
Lbl GM
Repeat A=3
Pt-Off(D,E,Pic2)
If T=(200-(P*10))
0->T
Pt-Off(D,E,Pic3)
rand^90->D
rand^52+8->E
A+1->A
Pt-Off(D,E,Pic2)
End
getKey->K
If getKey(0)
Pt-Off(B,C,Pic3)
B+(K=3*3)-(K=2*3)->B
C+(K=1*3)-(K=4*3)->C
Pt-Off(B,C,Pic1)
End
For(O,0,2-A)
Pt-Off(O*8,55,Pic4)
End
If A>0
Pt-Off(16,55,Pic3)
End
If A>1
Pt-Off(8,55,Pic3)
End
Text(25,58,P>Dec)
Text(50,58,A>Dec)
Text(55,58,T>Dec)
T+1->T
DispGraph
End
Return


Thanks!
Why is the game code all one subroutine?


Code:
.SHOOTER
DiagnosticOff
44->B
28->C
0->A->P->T
rand^95->D
rand^63->E
ClrHome
Disp "SHOOTER         "
Disp "PRESS ENTER"
Repeat getKey(9)
End
.Sprites
[007C9292EE92927C]->Pic1
[003844BAAABA4438]->Pic2
[0000000000000000]->Pic3
[00245A85854A2418]->Pic4
Pt-On(B,C,Pic1)
.Game Loop Code
Repeat A=3
Pt-Off(D,E,Pic2)
If T=(200-(P*10))
0->T
Pt-Off(D,E,Pic3)
rand^90->D
rand^52+8->E
A+1->A
Pt-Off(D,E,Pic2)
End
getKey->K
If getKey(0)
Pt-Off(B,C,Pic3)
B+(K=3*3)-(K=2*3)->B
C+(K=1*3)-(K=4*3)->C
Pt-Off(B,C,Pic1)
End
For(O,0,2-A)
Pt-Off(O*8,55,Pic4)
End
If A>0
Pt-Off(16,55,Pic3)
End
If A>1
Pt-Off(8,55,Pic3)
End
Text(25,58,P>Dec)
Text(50,58,A>Dec)
Text(55,58,T>Dec)
T+1->T
DispGraph
End
.Loss screen and return to TI-OS
ClrHome
Disp "YOU SHOT  TARGETS"
Pause 2500
ClrHome
Disp "SHOOTER         BY OLIENS       "
DiagnosticOn

Let me know if this helps.

Also, there is a more consolidated way of storing sprites. Instead of having each sprite have its own pointer, you can list them all one after another and just have one pointer to the whole list.
Like this:

Code:
[007C9292EE92927C][003844BAAABA4438][0000000000000000][00245A85854A2418]->Str1

Then to get each sprite you just need a single value multiplied by the length of each sprite code:

Code:
Pt-On(1,1,A*8+Str1)

"A" starts at 0 which is the first sprite, 1 for the second, and so on. The codes are 8 bytes long since each byte is 2 hex values (0-F.)
Thanks! I'll make sure to try this. I'm still new to Axe, so any help is appreciated! 😁

I'll make an edit to tell how it goes.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement