Quote:
:DelVar CDelVar D8→A
:8→B
:Repeat K=45
:ClrHome
:Output(A,B,"X
:getKey→K
:If D
:Then
:Output(D,C,"^
:D-1→D
:End
:If (K=21) and (A≠1
:Then
:B→C
:A→D
:End
:B+(K=26)1→B
:B-(K=24)1→B
:A-(K=25)1→A
You're missing an "If" here
:Then
:A+1→A
:If A>8
:1→8
:End
:If A<1
:8→A
:End
Rthprog is correct. You can also optimize this:


Code:
:B+(K=26)1→B
:B-(K=24)1→B
:A-(K=25)1→A
to
Code:
:B+(K=26→B
:B-(K=24→B
:A-(K=25→A
KermMartian wrote:

Code:
:B+(K=26→B
:B-(K=24→B
:A-(K=25→A


Pass #2

Code:
:K-25
:B+Ans(2>abs(Ans→B
:A-(K=25→A


Pass #3
(If additional variables can be used)

Code:
:K-25 →C
:B+C(2>abs(C→B
:A-not(C→A


*Weregoose call*

*Weregoose call*

Also, I spy a "1→8" towards the end... makes no sense :/
Yeah, but qazz said he can't understand optimized code, so I was trying to avoid that. Smile
no, no im not using sourcecoder's code, im sticking to the code im using...


ALSO!!

I finished the game, once someone explains how to use the code tag il put it here so you can say how much of a better programmer you are Razz

Only thing i need help with is how to slow down the enemy but you can first tell me how to use the code tags






heres the code for my finished progam


Code:
 :8→A
:8→B
:0→C
:0→D
:1→E
:randInt(1,16→F
:Input "ENEMY",Str1
:Input "WEAPON",Str2
:Repeat K=45
:randInt(1,16→F
:ClrHome
:Output(A,B,"X
:Output(E,F,Str1
:If F>16
:Then
:1→F
:End
:getKey→K
:If D≠0
:Then
:Output(D,C,Str2
:D-1→D
:End
:If (K=21) and (K≠1)
:Then
:B→C
:A→D
:End
:If K=26
:Then
:B+1→B
:End
:If K=24
:Then
:B-1→B
:End
:If K=25
:Then
:A-1→A
:End
:If K=34
:Then
:A+1→A
:If A>8
:1→A
:End
:If A<1
:Then
:8→A
:End
:If B>16
:Then
:1→B
:End
:If B<1
:Then
:16→B
:End
:If E=A and F=B
:Then
:Output(4,4,"LOSER
:Return
:Else
:End
:If E=D and F=C
:Then
:Output(E,F,"*
:Output(4,4,"WINNER
:Return
:Else
:End
:End




http://www.mediafire.com/?mnwl4xz5udu
this looks pretty good: two suggestions though, 1) make the enemies move more fluently, ie instead of doing randint() to make him move, try F+1-16(F=16)-->F 2)maybe make the beggining parts where you choose your enemy/weapon with a colon, ie "Enemy:" "Weapon:". Other than that, it looks pretty good. Good job, I expect that you will be making pretty good/cool programs soon.

Edit:

Code:
:If F>16
:Then
:1→F
:End

This code is kind of redundant, randint(1,16) will always return an integer between 1 and 16, never higher, never lower.

Edit2: using E is also kind of pointless (unless you were to edit this so he moves lower over time), you store 1 to E but you never edit E, but I assume you will be making him move lower, because you already have the code where if his position is equal to your position it will say loser.

Edit3:

Code:
:If E=A and F=B
:Then
:Output(4,4,"LOSER
:Return
:Else
:End

The :Else:End part is not needed, you can replace it with a simple :End
haha thanks


Thanks a million for giving me the code for shooting, that really stumped me.

Also, now im out of ideas for now Smile


jk jk ill make a maze next once i learn matrices

EDIT: Yeah i realize this, its just that the variables were mixing me up Sad
matrices are kind of wierd, I rarely use them myself. But the thing you need to remember for matrices is: to access a certain spot in a matrix, use [A](Y,X) Matrices use the same system as output, ie [A](1,1) gives you the top left corner of the matrices. one other thing, matrices take up a LOT of memory, I don't think its any more than lists, but IMO a maze game would best be made with a string. That way, you already have the characters ready, and (ussually) each character in a string takes up 1 byte, each character in a matrix takes up 11 bytes iirc.
I know, I know, but here are some minor optimizations

TI-Basic wrote:
:8→B
:DelVar CDelVar D8→A
:1→E
:Input "ENEMY",Str1
:Input "WEAPON",Str2
:Repeat K=45
:randInt(1,16→F
:ClrHome
:Output(A,B,"X
:Output(E,F,Str1
:If F>16
:1→F
:getKey→K
:If D
:Then
:Output(D,C,Str2
:D-1→D
:End
:If (K=21) and (K-1//This part is redundant. If K=21, K is obviously not equal to 1
:Then
:B→C
:A→D
:End
:K-25
:B+Ans(2>abs(Ans→B
:A+(K=34)-(K=25→A

:If K=34
:Then
:If A>8
:1→A
:If A<1
:8→A
:If B>16
:1→B
:If B<1
:16→B

:If E=A and F=B
:Then
:Output(4,4,"LOSER
:Return
:End
:If E=D and F=C
:Then
:Output(E,F,"*
:Output(4,4,"WINNER
:Return
:End //No need for "Else:End"
:End
0_o


:K-25
:B+Ans(2>abs(Ans→B
:A+(K=34)-(K=25→A


^ not familiar with that so not using it



Also, how would i be able to slow the enemy?
qazz42 wrote:
Also, how would i be able to slow the enemy?


I'm not entirely sure what you mean, but this might do the trick


Code:
:If D
:Then
:Output(D,C,Str2
:D-1→D
:End

Change "-1" to "-.5"

Everywhere else, whenever you refer to "D", use "iPart(D)" instead. It's a kludgy solution, but it'll work.
No i mean make it so that it moves fluently like player's idea BUT still moves like how it did before.....
wait...what?

if it moves like it was before, it won't be moving fluently at all. Fluently (imo) is only moving one space at a time. to make it move like how I was saying, replace the second randint(1,16)-->F with F+1-16(F=16)-->F
ok... the game is funner my way Sad
  
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 3 of 3
» 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