This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 28 Jul 2009 11:27:11 pm    Post subject:

I have made a pong game that is free to anyone in return I ask for someone to help me make a full rpg game


Code:
PROGRAM:PONG
:ClrHome
:Output(4,1,"::::::PONG::::::"
:Output(5,1,"BY: ADAM WHEELER
:Output(8,3,"PRESS  ENTER
:Pause
:ClrHome
:Lbl 1
:ClrHome
:-2->I
:7->A:8->B
:DelVar C1->X
:-1->Y:6->Z
:While Not(C
:ClrHome
:Output(A,B,"O
:Output(8,Z,"(---)
:If A=1
:-X->X
:If A=7 and B>=Z and B<=Z+5
:-X->X
:If A=7:I+1->I
:Output(1,1,I+1
:Output(1,14,U
:If B=1 xor B=16
:-Y->Y
:If A=8:Then
:1->C
:V-1->V
:End
:A+X->A
:B+Y->B
:Getkey
:Z+(ans=26)-(ans=24)
:If 13<=ans
:1
:If 0>=ans
:12
:ans->Z
:End
:ClrHome
:Output(4,5,"YOU LOSE
:Pause
:ClrHome
:If I>U:Then
:I->U
:Output(4,2,"NEW HIGH SCORE
:Output(5,8,U
:Goto 2
:Else
:Goto 2
:Lbl 2
:Menu("PLAY AGAIN","YES",1,"NO",3
:Lbl 3
:ClrHome


Complete


Last edited by Guest on 30 Jul 2009 01:06:30 am; edited 1 time in total
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 29 Jul 2009 08:10:26 am    Post subject:

Um.. We don't really do deal negotiations here. You can't "sell" your games. All TI games are free. We will help you make an rpg, sure. What do you need to know?
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 29 Jul 2009 08:38:55 am    Post subject:

We will all help, but there are not "trades" like this.

Time to Optimize! (Don't type the stuff after // (It's a comment))

Code:
PROGRAM:PONG
:ClrHome
:Output(4,1,"::::::PONG::::::BY: ADAM WHEELER // Output wraps around the screen if it's too long.
:Output(8,3,"PRESS  ENTER
:Pause
 // The ClrHome that was here was "unused" because it hits another ClrHome after While not(C.
:Lbl 1
 // The ClrHome that was here was "unused" because it hits another ClrHome after While not(C.
:-2->I
:7->A:8->B
:DelVar C1->X
:-1->Y:6->Z
:While Not(C
:ClrHome
:Output(A,B,"O
:Output(8,Z,"(---)
:If A=1
:-X->X
:If A=7 and B>=Z and B<=Z+5
:-X->X
:If A=7:I+1->I
:Output(1,1,I+1
:Output(1,14,U
:If B=1 xor B=16
:-Y->Y
:If A=8:Then
:1->C
:V-1->V
:End
:A+X->A
:B+Y->B
:Getkey
:Z+(ans=26)-(ans=24 //Leave off closing parenthesis to save a bite.
:Ans-12(Ans=13)+12not(Ans->Z //Using logic to make this smaller and faster.
:End


It's not compleetly optimized, so if anyone else wants to, be my guest.

Go to TIBD to learn more stuff; It's a great place for beginners.
http://tibasicdev.wikidot.com/home


Last edited by Guest on 29 Jul 2009 08:39:28 am; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 29 Jul 2009 08:29:53 pm    Post subject:

Welcome to United-TI! :)

That definitely looks like a good start. If you were asked to write it again from scratch, would you take the exact same approach, I wonder? Or, would you boil it down to the point where you end up using less instructions for a similar outcome? It's important to get your ducks in a row in terms of optimizing these fledgling programs before you get to work on something as incredibly ambitious as an RPG, which is notorious for revealing the full extent of the capabilities of both the language and the programmer. Just don't be flabbergasted if you run smack into a brick wall somewhere along the line, because it's not easy to go from assembling a bird house to building a full-sized one.

Take a quick look:

:If A=1
:-X→X
:If A=7 and B[font="verdana"]≥
Z and B[font="verdana"]≤
Z+5
:-X→X

Couldn't that be streamlined a bit more? If you're determined to start producing one hundred blocks of code similar to that one, then you'd be doing yourself a huge favor by simplifying it beforehand – it'll reduce not only the overall program size, but the total extra minutes that you'd spend thinking about it first and then typing it in. (Have you ever wondered why there are four fingers on Mickey Mouse's hand as opposed to five? Drawing those extra lines frame-by-frame can really take a good chunk out of a person's day!)

Additionally, to be able to point to a line of code and say, "This is what this does," is a good exercise. It shows that you can effectively read and write in the same language, which should help you to better associate which behaviors in the program are caused by what instructions. Going back and reinterpreting the simplicity of these behaviors might move you to write less-complicated code to bring about the same effect. (I have this crazy belief that there is a shortest path to any sequence of outputs – realizing, of course, that shortest is not always fastest.)

An example of reading and writing: Can you tell me what If B=1 xor B=16 does? (No, no, what does it do exactly?) Or, here's a better question: How might B equal 1 and 16 simultaneously in order to make that line false? ...Much like proofreading, reading what you have written is a mandatory procedure in programming if you ever feel the need to improve upon your code. The wiki is there for your perusal. Feel free to ask us about the really difficult stuff (and command syntax isn't).

And good luck with your RPG. ;)

–Goose

Last edited by Guest on 05 Jul 2010 08:19:12 am; edited 1 time in total
Back to top
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 30 Jul 2009 01:14:29 am    Post subject:

I finished typing the game and as far as optimization that was the original code its a lot better coded on my calculator I just havent wrote it down


The rpg I was wanting to make is a graphical adventure game... I made one with three screens and it is to slow so i need help with a new one
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 30 Jul 2009 11:56:15 am    Post subject:

Graphics...
Are you using pure basic, or xLib/Celtic III
Back to top
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 30 Jul 2009 06:08:00 pm    Post subject:

I am using pure basic to do this and I have figured out its better to use subroutines instead of Lbls because the if:goto statements are to slow...

I want to make an adventure game with a map that is 10×10 at least and using subroutines this could be done
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 30 Jul 2009 07:13:56 pm    Post subject:

Cool! (I like pure basic...)

You can kinda use subroutiens within a program. ex:

Code:
Goto A

Lbl B
subroutine
End
End

more subroutiens here

Lbl A

While 1

If something
Then
Goto B
End
End


Or you can do it the normal way (see next post). Smile


Last edited by Guest on 30 Jul 2009 09:15:15 pm; edited 1 time in total
Back to top
IAmACalculator
In a state of quasi-hiatus


Know-It-All


Joined: 21 Oct 2005
Posts: 1571

Posted: 30 Jul 2009 08:49:29 pm    Post subject:

Or, alternately, you can actually write the routine in a separate program and then call it inside your main program using prgmSUBPRGM (or whatever you choose to name it).
Back to top
AMkiller


Advanced Newbie


Joined: 16 Dec 2008
Posts: 64

Posted: 31 Jul 2009 09:57:36 am    Post subject:

I recommend celtic III
Back to top
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 31 Jul 2009 02:42:19 pm    Post subject:

I dont know how to use or even get celtic III and i plan to use prgmSUBROUTN kind of thing
Back to top
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 31 Jul 2009 03:14:20 pm    Post subject:

Full pong game

Code:
PROGRAM:PONG
:ClrHome
:Output(4,1,"::::::PONG::::::BY: ADAM WHEELER
:Pause
:Lbl 1
:-1→I
:0→k
:7→A:8→B
:1→X
:-1→Y:6→Z
:While (K=0
:ClrHome
:Output(A,B,"O
:Output(8,Z,"---"
:If A=1
:-X→X
:If A=7 and B≥Z and B≤Z+3
:-X→X
:If A=7:I+1→I
:Output(1,1,I
:Output(1,14,U
:If B=1 xor B=16
:-Y→Y
:If A=8:Then
:1→C
:V-1→V
:End
:A+X→A
:B+Y→B
:Getkey
:Z+(ans=26)-(ans=24
:Ans-14(Ans=15)+14not(Ans->Z
:End
:Output(4,5,"YOU LOSE
:Pause
:ClrHome
:If I>U:Then
:I→U
:Output(4,2,"NEW HIGH SCORE
:Output(5,8,U
:Goto 2
:Else
:Goto 2
:Lbl 2
:Menu("PLAY AGAIN","YES",1,"NO",3
:Lbl 3
:ClrHome

The code is a little more optomized

More basic pong game without scoring

Code:
PROGRAM:PONGSTP
:7→A:8→B
:DelVar C1→X
:-1→Y:6→Z
:While Not(C
:ClrHome
:Output(A,B,"O
:Output(8,Z,"-----
:If A=1
:-X→X
:If A=7 and B≥Z and B≤Z+5
:-X→X
:If B=1 xor B=16
:-Y→Y
:If A=8:Then
:1→C
:V-1→V
:End
:A+X→A
:B+Y→B
:Getkey
:Z+(ans=26)-(ans=24
:Ans-12(Ans=13)+12not(Ans->Z
:End
:Output(4,5,"YOU LOSE
:Pause
:ClrHome


This is a faster version of my original pong game


Last edited by Guest on 03 Aug 2009 10:34:21 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 31 Jul 2009 03:59:13 pm    Post subject:

For the sake of lucidity and reduced VST (Vertical Scrolling Time), I must ask you to hold back from double-posting. Review the Terms and Conditions, and remember to use the button next time. (To practice, you could use this feature to merge your consecutive replies.)

Are you picking apart your code line-by-line? Go with the simple premise that every line can be improved somehow, and don't stop looking until you've exhausted all the possibilities with each one. I'm eyeballing quite a few in there.

An interesting thing about the Repeat command is that the condition is ignored until the loop is already given one pass. You could leave out the C variable and then consider by what premise exactly the loop will terminate, and accept that as the actual condition for the loop. Make sense?


Last edited by Guest on 05 Jul 2010 08:18:27 am; edited 1 time in total
Back to top
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 08 Oct 2009 08:51:47 am    Post subject:

Im working on an update for this that will be much faster


this is the main code though

Code:

PROGRAM:PONG
:ClrHome
:Output(4,1,"::::::PONG::::::BY: ADAM WHEELER
:Pause
:Lbl 1
:-1→I:0→k
:7→A:8→B
:1→X:-1→Y
:6→Z
:While (K=0
:ClrHome
:Output(A,B,"O
:Output(8,Z,"---"
:If A=1
:-X→X
:If A=7 and B≥Z and B≤Z+3
:-X→X
:If A=7:I+1→I
:Output(1,1,I
:Output(1,14,U
:If B=1 xor B=16
:-Y→Y
:V-1(A=8→V
:End
:A+X→A
:B+Y→B
:Getkey
:Z+(ans=26)-(ans=24
:Ans-14(Ans=15)+14not(Ans->Z
:End
:Output(4,5,"YOU LOSE
:Pause
:If I>U:Then
:I→U
:Output(4,2,"NEW HIGH SCORE
:Output(5,8,U
:Goto 2
:Else
:Goto 2
:Lbl 2
:Menu("PLAY AGAIN","YES",1,"NO",3
:Lbl 3
:ClrHome
Back to top
MageKing17


Newbie


Joined: 17 Sep 2009
Posts: 3

Posted: 08 Oct 2009 11:43:53 am    Post subject:

So what's with the XOR obsession? How is it helping you, as opposed to your average OR?
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 08 Oct 2009 05:04:34 pm    Post subject:

Xor is only true if one or the other is ie:
A=12. B=3
A=12 Xor b=3 false
A=12 xor b=4. True
Back to top
calcdude84se


Member


Joined: 09 Aug 2009
Posts: 207

Posted: 08 Oct 2009 07:30:44 pm    Post subject:

Yes, but I think he was saying that since B can never equal 1 and 16 at the same time, "or" does the same as "xor". Also, most of us tend towards "or" over "xor" when we have a choice. ([joke]Reason: It's one character shorter, so it saves a bit of screen space :biggrin:[/joke])
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 08 Oct 2009 10:09:52 pm    Post subject:

Srry.
I did not actually get to look at the code my iPod won't let me
Back to top
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 28 Oct 2009 10:34:26 am    Post subject:

I know what or and xor do i made the primary game code a year ago when i first started programming and it seemed simpler at the time
Back to top
Eeems


Advanced Member


Joined: 25 Jan 2009
Posts: 277

Posted: 28 Oct 2009 12:09:12 pm    Post subject:

dxfan101010 wrote:
Srry.
I did not actually get to look at the code my iPod won't let me
Actually you can see it, you just have to copy the section into a note
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement