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: 11 Feb 2010 09:59:26 am    Post subject:

I got bored yesterday and made a two player ping pong game however both players use the same calc i will edit this post with the code later as i dont have it right now (loaned the writin copy to a friend) but 1st player uses the 2nd and alpha keys while 2nd player uses the up and down keys i am issuing a challenge to see who can beat me in size while incoorperating all the features

2 pause buttons (1 for each)
a name changer as it displays both players names
a scoretracker for both
completely two player
a title screen
and a main menu

if it has all these and is smaller than mine you win! Smile mine is 499b

Code:

[color=white]
Ping Pong V1.2 499b
ClrHome
Output(4,1," PING PONG V1.2  BY: SHADOWKING
Pause
Lbl 1
Menu("PING PONG","PLAY",2,"CHANGE NAMES",3,"QUIT",4
Lbl 3
ClrHome
Input "PLAYER ONE ",Str4
Input "PLAYER TWO ",Str5
Pause
Goto 1
Lbl 2
0->K:5->H
5->A:8->I
5->B:0->E
1->X:0->F
-1->Y:0->G
While (E=0
Output(1,5,F
Output(1,10,G
Output(H,I,"O
Output(A,1,"]
Output(B,16,"[
If H=1 or If H=8
-X->X
If I=2 and A=H
-Y->Y
If I=15 and B=H
-Y->Y
If I=16:Then
F+1->F
-Y->Y
End
If I=1:Then
G+1->G
-Y->Y
End
H+X->H
I+Y->I
GetKey->K
If K=41 xor K=45
Pause
A+(K=31)-(K=21)->A
A-8(A=9)+8not(A->A
B+(K=34)-(K=25)->B
B-8(A=9)+8not(B->B
If F=20 or G=20
E+1->E
End
If F=20
Output(4,4,Str4+" WIN
If G=20
Output(4,4,Str5+" WIN
Pause
Goto 1
Lbl 4
ClrHome
" [/color]


Last edited by Guest on 14 Feb 2010 10:48:04 am; edited 1 time in total
Back to top
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 11 Feb 2010 09:12:42 pm    Post subject:

The problem with 2 player games in BASIC is that you can't detect two keypresses at once - it can never be "completely" 2 player.
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 11 Feb 2010 09:44:10 pm    Post subject:

That sounds really cool! The only problem I see is that you can only detect one keypress at a time. If you can work around this, it would be awesome! It still sounds pretty good. Smile
Back to top
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 12 Feb 2010 09:11:31 am    Post subject:

Ed H wrote:
The problem with 2 player games in BASIC is that you can't detect two keypresses at once - it can never be "completely" 2 player.


both keypresses run in the same loop and react quick enough for the game to function thereby simulating as tho both keys can be pressed at the same time
Back to top
calcdude84se


Member


Joined: 09 Aug 2009
Posts: 207

Posted: 12 Feb 2010 04:46:21 pm    Post subject:

What they are saying is that if one key is held down, pressing another will do nothing. getKey will return 0.
Back to top
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 14 Feb 2010 10:49:34 am    Post subject:

I have edited my first post to include the code but i cant help that glitch with getkey
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