Author |
Message |
|
WhiteDwarf
Newbie
Joined: 10 Nov 2003 Posts: 19
|
Posted: 10 Nov 2003 02:55:07 pm Post subject: |
|
|
Hey i'm new to TI-calculators, and they're great....i'm in Algebra II and they save tons of time with systems of equations, not to mention their graphing helps alot, anywho I just got into the programming aspect of them, i have some experience in other languages but i'm an overall bad programmer and noob, so i'm trying to write a Pong program (like my 3rd day of programming in TI-BASIC) so right now i'm just writing the "paddle" for you that moves up and down the screen, and i am having a hard time with it, i used one method where it was a clrhome loop kinda deal to get rid of the waste pixels when moving the bar up and down....but it would blink! soooo fast, so i decided to try another method and here's my source code for the pong program...but it isn't working
Code: ClrDraw
:0->Xmin
:94->Xmax
:0->Ymin
:62->Ymax
:35->A
:ClrHome
:AxesOff
:FnOff
:GridOff
:Lbl 1
:While 1
:getKey->G
:If G=25:Then
:A+7->A
:Goto 2
:End
:If G=34:Then
:A-7->A
:Goto 2
:End
:If G=22:Then
:ClrHome
:Stop
:End
:Lbl 2
:If A<1:Then
:1->A
:End
:If A+15>60:Then
:45->A
:End
:Line(3,A,3,A+15
:If G=25:Then
:For(X,a-7,a,1
: Pt-Off(3,X
:End
:End
:If G=34:Then
:For(X,a+7,a,-1
: pt-Off(3,X
:End
:End
:Goto 1
But like, i can make it work for just going up, by doing something like
Code: :Line(3,A,3,A+15
:For(X,a-7,a,1
: Pt-Off(3,X
so i think it's something to do with my IF statements....
thanksalot, p.s. great board |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 10 Nov 2003 03:23:11 pm Post subject: |
|
|
It looks to me like your program needs much work and has a few problems that will cause your game to be unplesant to play.
For one, you used a goto lbl. I have not checked your code, so just make sure you do not jump from within an then statement or any other loop. Also note if you are going to run an infinate loop, you can use a while loop. This causes the infamous basic program slowdown fatigue
As for your pong paddle blinking, try erasing it instead of clearing the screen each loop. It will look much better.
If you turn on the following line:
Line(10,20,40,20
you can turn it off with
Line(10,20,40,20,0
Lastly, I do not think you have enough code to make Pong. It seems to me that what you have is likly part of the game and unoptimized. |
|
Back to top |
|
|
Jeffrey
Member
Joined: 12 Jun 2003 Posts: 212
|
Posted: 10 Nov 2003 04:02:45 pm Post subject: |
|
|
Most new programmers begin a language having the goal to create a game. Many of these new programmers want to try it right away, and many pick Pong. The idea is hat Pong is such an elementary game, it was made in the 60's (in labs), so the technology was thinner back then and programming Pong must be easy. Not the case. While pong is easier than many other games, it still is a hard game to produce with it still being fast and enjoyable. You have to make routines for the movement of the paddle while simultaneously controlling the movement of the ball. And then you have to create the AI, as well as a second paddle.
I would recommend programming math programs, then moving on the graphics. Graphics is a under-studied subject in BASIC, and it takes a little while to study and understand them before a true game can be made. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 10 Nov 2003 04:40:19 pm Post subject: |
|
|
I think that both of the labels and all the gotos you have in the program are unnecessary. Also, the 'a' might be causing an error (if it's the 'a' from the vars/stat menu, it cannot have a value stored to it in any simple way; if you typed a lowercase 'a' by pressing alpha twice, it cannot have a value stored to it at all), try using B.
This is better, though, than anything I wrote after 3 days of learning TI-Basic. Try writing a guessing game - it's easier to start with. |
|
Back to top |
|
|
Jeffrey
Member
Joined: 12 Jun 2003 Posts: 212
|
Posted: 10 Nov 2003 05:16:46 pm Post subject: |
|
|
I would agree with Sir Robin. I wasnt trying to be diminutive in my first post, if thats the way it seemed, but I would agree that a guessing game would be much better suited for a beginning programmer. You may become frustrated with creating a harder game like Pong, and end up quitting the language. |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 11 Nov 2003 04:24:26 pm Post subject: |
|
|
I am not trying to discurage anyone from creating a game, but I suggest you write little tiny scripts using most of the basic commands, then move on to messing with lists, strings, ...
After that, write math programs, then a game that uses the homescreen.
Finally move on to graphics then lastly a game that uses graphics.
Really, starting a game that uses graphics is like driving a big 18 wheeler without first driving a car.
-Jbirk
Still, we will help you with whatever you decide to make. We are not trying to discourage you. |
|
Back to top |
|
|
WhiteDwarf
Newbie
Joined: 10 Nov 2003 Posts: 19
|
Posted: 11 Nov 2003 06:12:31 pm Post subject: |
|
|
lol i took your guys advice I made a fibonassi program
Code: : 0->A:1->B:0->C
: Input "HOW MANY?",N
: For(X,1,N,1
: A+B->C
: Disp C
: B->A:C->B
: Pause
: End i made a lil guessing game also...it works fine the game itself but i tried to add a record saving option and am having a tad bit of trouble.....even when i type in something like this into my calculator i'm getting syntax problems [3,3,3],[3,3,3]->[B]
I know matrices are different than lists, i'm still just curious of why that's getting problems, i can still edit it through MATRX, edit....but i read in a tutorial u can also use that method which seems faster and nicer
the syntax error that comes back is
[3,3,3"]"
Last edited by Guest on 11 Nov 2003 06:15:05 pm; edited 1 time in total |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 11 Nov 2003 06:32:33 pm Post subject: |
|
|
THIS is how you store a matrix like that : Code: [[3,3,3][3,3,3]]->[B] but please note that the ending 2 ]s are unneeded as the ti-os will add them for you... BUT DONT WORRY ABOUT THAT RIGHT NOW! lol
Last edited by Guest on 11 Nov 2003 06:32:45 pm; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 11 Nov 2003 06:45:23 pm Post subject: |
|
|
On the 89, writing {{3,3,3},{3,3,3}} also works, is that possible on the 83+?
Why would you need to use matrices? The only time I ever used them was to make a maze game... try using lists.
There is also a non-recursive formula for fibonacci numbers... will somebody please tell me what it is (I remember it involves exponents)? |
|
Back to top |
|
|
WhiteDwarf
Newbie
Joined: 10 Nov 2003 Posts: 19
|
Posted: 11 Nov 2003 07:08:29 pm Post subject: |
|
|
lol i'm still gettting errors!, no it's not for my program i'm just trying to enter numbers into a matrix.....i thought i saw that method used, would i have to use fill()
then?
*EDit* btw i found that non-recurisve formula for finding the nth number of the sequence Fn = http://mathworld.wolfram.com/BinetsFibonac...berFormula.html
Last edited by Guest on 11 Nov 2003 10:00:45 pm; edited 1 time in total |
|
Back to top |
|
|
Spyderbyte
Advanced Member
Joined: 29 May 2003 Posts: 372
|
Posted: 11 Nov 2003 10:21:08 pm Post subject: |
|
|
Fill(3,[B]) will turn every number in Matrix [B] to a 3, but will leave the dimensions the same. For example, [[1,2][3,4]] will become [[3,3][3,3]]
If you want to specically create a 2x3 matrix with 3s, you would still use [[3,3,3][3,3,3]]->[B] no matter if it is in a program or on the homescreen.
Hope this helps!
Spyderbyte |
|
Back to top |
|
|
WhiteDwarf
Newbie
Joined: 10 Nov 2003 Posts: 19
|
Posted: 11 Nov 2003 11:37:04 pm Post subject: |
|
|
yea sweet, i got it to work, thanks alot man :)
o btw Sir Robin i wrote that non-recursive Fibonacci method to find nth of F
Code: : Input "Nth?",N
: ((1+sqroot(5))/2)^N-((1-sqroot(5))/2)^N->N
: N/sqroot(5)->N
: Disp N
|
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 12 Nov 2003 05:43:13 pm Post subject: |
|
|
thanks.
btw, if it's the last line of a program, :N will display N instead of done. |
|
Back to top |
|
|
Jedd 1980 Pong World Champion
Elite
Joined: 18 Nov 2003 Posts: 823
|
Posted: 25 Nov 2003 12:49:39 am Post subject: |
|
|
I know this is an old forum, but has anyone managed to make a decent pong game for the 83+ that runs fast? I mean something graphical, not homescreen text, and something that allows both players to move at the same time, and is written in basic? I think everything i wrote there is pretty much impossible when put together, but ive tried a few times and no luck. Has anyone else come close? |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 25 Nov 2003 09:32:45 am Post subject: |
|
|
Jup, just use Ans and boolean logic a lot (and don't use cos/sin/tan put predefined directions for the ball, I used 6 directions since there's not need for the ball to move straight up or down). I removed the 2 player function though, everytime 1 player moved the other player's movement would be interupted so it become a game of who was able to tap their key the fastest.
Note that I've reset my memory a bunch of times since then.
Last edited by Guest on 25 Nov 2003 09:34:02 am; edited 1 time in total |
|
Back to top |
|
|
Jedd 1980 Pong World Champion
Elite
Joined: 18 Nov 2003 Posts: 823
|
Posted: 25 Nov 2003 10:43:40 am Post subject: |
|
|
Ok thanks. I'll try to program something similar. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 26 Nov 2003 02:38:47 pm Post subject: |
|
|
You could program a two - player pong linking two calculators. Then you would have no problem having two keys pressed at the same time. |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 26 Nov 2003 02:40:21 pm Post subject: |
|
|
But then you'd need asm for it to run smooth, because of the whole getCalc(-only-works-when-the-other-calc-is-paused-problem, wouldn't you? |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 26 Nov 2003 02:48:30 pm Post subject: |
|
|
there was a link to an asm program called ZENTER in the Get/Send topic. It gets the other calc out of pause. |
|
Back to top |
|
|
|