Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 132 users online: 11 members, 96 guests and 25 bots. Members: 0rac343, aeTIos, CalebHansberry, HOMER-16, legodude, qazz42, rcfreak0, Spyro543. Bots: Spinn3r (1), Magpie Crawler (2), Googlebot (21), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
rthprog

Expert

Joined: 21 Sep 2007 Posts: 726 Location: Pittsburgh, PA
|
Posted: 21 May 2010 07:37:14 pm Post subject: |
|
|
| 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 |
|
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55751 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
rthprog

Expert

Joined: 21 Sep 2007 Posts: 726 Location: Pittsburgh, PA
|
Posted: 21 May 2010 08:40:22 pm Post subject: |
|
|
| 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 :/ |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55751 Location: Earth, Sol, Milky Way
|
Posted: 21 May 2010 08:44:37 pm Post subject: |
|
|
Yeah, but qazz said he can't understand optimized code, so I was trying to avoid that.  _________________
 |
|
| Back to top |
|
|
qazz42

Vampire Killer

Joined: 07 Apr 2010 Posts: 4177
|
Posted: 22 May 2010 09:10:59 am Post subject: |
|
|
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
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 _________________
 |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2958
|
Posted: 22 May 2010 02:05:30 pm Post subject: |
|
|
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 _________________ http://tanner.myserverathome.com
 |
|
| Back to top |
|
|
qazz42

Vampire Killer

Joined: 07 Apr 2010 Posts: 4177
|
Posted: 22 May 2010 02:13:58 pm Post subject: |
|
|
haha thanks
Thanks a million for giving me the code for shooting, that really stumped me.
Also, now im out of ideas for now
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  _________________
 |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2958
|
Posted: 22 May 2010 02:17:46 pm Post subject: |
|
|
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. _________________ http://tanner.myserverathome.com
 |
|
| Back to top |
|
|
rthprog

Expert

Joined: 21 Sep 2007 Posts: 726 Location: Pittsburgh, PA
|
Posted: 22 May 2010 02:50:49 pm Post subject: |
|
|
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 |
Last edited by rthprog on 22 May 2010 03:03:23 pm; edited 3 times in total |
|
| Back to top |
|
|
qazz42

Vampire Killer

Joined: 07 Apr 2010 Posts: 4177
|
Posted: 22 May 2010 03:00:59 pm Post subject: |
|
|
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? _________________
 |
|
| Back to top |
|
|
rthprog

Expert

Joined: 21 Sep 2007 Posts: 726 Location: Pittsburgh, PA
|
Posted: 22 May 2010 03:06:48 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
|
qazz42

Vampire Killer

Joined: 07 Apr 2010 Posts: 4177
|
Posted: 22 May 2010 03:11:12 pm Post subject: |
|
|
No i mean make it so that it moves fluently like player's idea BUT still moves like how it did before..... _________________
 |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2958
|
Posted: 22 May 2010 03:17:07 pm Post subject: |
|
|
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 _________________ http://tanner.myserverathome.com
 |
|
| Back to top |
|
|
qazz42

Vampire Killer

Joined: 07 Apr 2010 Posts: 4177
|
Posted: 22 May 2010 03:18:37 pm Post subject: |
|
|
ok... the game is funner my way  _________________
 |
|
| Back to top |
|
|
|
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
|
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
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.035756 seconds.
|