Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Netham45 on August 10, 2007, 12:07:00 pm

Title: PONG!
Post by: Netham45 on August 10, 2007, 12:07:00 pm
Got bored on the way up to Wyoming to spend the night with my grandparents(on the way to South Dakota), so I pulled out my 84 and started on a pong game. Right now, I have a 4d(diagonal only) ball movement(bounces off of all the walls correctly, and player paddle movement.

What I need to do: Make an AI, and make the ball detect the paddles(it goes through them).

Currently, I did a test, and it is moving at 5FPS.
Title: PONG!
Post by: Speler on August 10, 2007, 01:29:00 pm
I wrote my TI pong game in about two hours.  It had pretty cool physics (like a 2D curveball clone).
Title: PONG!
Post by: Netham45 on August 10, 2007, 01:42:00 pm
heh, cool. Im kinda rusty at coding, havn't done it in about 6 months on a calc, so I am doing this as a get-back-into-coding thing.
Title: PONG!
Post by: Speler on August 10, 2007, 01:45:00 pm
Me as well, it's taking me hours to do what would normally take me minutes (ok, maybe like half as much time) in the past.  Oh well, I guess that just means I should get started again.
Title: PONG!
Post by: DJ Omnimaga on August 10, 2007, 01:50:00 pm
QuoteBegin-Netham45+10 Aug, 2007, 20:42-->
QUOTE (Netham45 @ 10 Aug, 2007, 20:42)
get-back-into-coding thing.  

 for some reasons at first I've read this as geek-back-into-coding :Dbiggrin.gif

ANyway i hope you add some features to make it different from the 438 pong games alerady in ticalc.org archives ;)wink.gif
Title: PONG!
Post by: AaroneusTheGreat on August 10, 2007, 06:13:00 pm
wow, yea I've contributed mine, I'm surprised they took it. It was my first C game, it sucked the big one. :Ptongue.gif
Title: PONG!
Post by: DJ Omnimaga on August 10, 2007, 06:41:00 pm
I didn't knew they even still accepted pong games o.oblink.gif

I guess its a good thing they do tho because who know netham is maybe making it 6 level gray :Dbiggrin.gif
Title: PONG!
Post by: Netham45 on August 10, 2007, 08:38:00 pm
Got it working. It is using one If statement, and it is outside of the loop to determine who won.

It is averaging 4-7 FPS, depending on rather the AI or the Human player moved.

I'll post the source in a .8XP format next sunday(when I get back home,) but I have it typed at the bottom of this message.

Im going to work on one that has 'If' statements to show just how much faster the 'While' loops were.

It is using the finance variables for all the variables that can't be overwritten(direction,score,paddle position, ball coordinates)

Note: PMT, N, C/Y, P/Y, I%,PV and FV are all finance variables. I will lowercase all normal variables. I also bolded the financial variables.
QuoteBegin-Pong+-->
QUOTE (Pong)

ClrDraw
randInt(1,4->PMT
46->N
2randInt(1,3->I%
5->C/Y
5->P/Y
->PV
->FV
->Xmin
94->Xmax
->Ymin
62->Ymax
AxesOff
->r
2->(Theta)
Line(7,30,7,22
While (PV!=10)(FV!=10
(Theta)+1->(Theta)
While r=0
Text(0,0,PV
Text(0,91,FV
Vertical 3
Vertical 90
1->r
End
getkey->g
while (g=25)(P/Y!=1
Line(7,0,7,62,0
P/Y-1->P/Y
1->g
Line(7,62-(P/Y8-8),7,62-(P/Y8
End
While (g=34)(P/Y!=8
Line(7,0,7,62,0
P/Y+1->P/Y
1->g
Line(7,62-(P/Y8-8),7,62-(P/Y8
End
While ((I%=0)+(I%=62)+(N=4)+(N=88))(g!=188
(4(I%=62)(PMT=3))+(2(I%=62)(PMT=1))+(3(I%=0)(PMT=4))+((I%=0)(PMT=2))+(4(N=4)(PMT=2))+((N=88)(PMT=3))+(2(N=88)(PMT=4))+(3(N=4)(I%=0))+($(N=4)(I%=62))+(2(N=88)(I%=62))+(N=88)(I%=->PMT
188->g
End
Pxl-Off(I%,N
N-2(PMT=2)+2(PMT=4)-2(PMT-1)+2(PMT=3)->N
I%+2(PMT=1)+2(PMT=3)-2(PMT=2)-2(PMT=4->I%
Pxl-On(I%,N
->g
While (N=84)(g!=154)(I%>C/Y8-9)(I%<C/Y8+1)((PMT=3)+(PMT=4
1(PMT=3)+2(PMT=4->PMT
154->g
End
While ((N=6)+(N=8))(g!=155)(I%>(P/Y-1)8-1)(I%<P/Y8+1)((PMT=1)+(PMT=2
3(PMT=1)+4(PMT=2->PMT
155->g
End
While ((N=4)+(N=88))(r!=0
PV+(N=88->PV
FV+(N=4->FV
->r
End
While (Theta)=4
Line(85,0,85,62,0
C/Y+(C/Y!=8)(I%>C/Y8)-C/Y!=1)(I%<C/Y8-8->C/Y
Line(85,62-(C/Y8-8),85,62(C/Y8
->(Theta)
End
End
If PV=10:Then
Text(30,25,"Player Won!
Else
Text(28,25,"Calculator Won!
Endif
"
Title: PONG!
Post by: DJ Omnimaga on August 11, 2007, 01:54:00 am
yay for boolean logic sometimes it make things faster and even smaller in some cases. I hope to be able to try the game soon
Title: PONG!
Post by: JonimusPrime on August 11, 2007, 02:59:00 am
Hey you stole my idea meanie...
I mean nice job i was just about to work on a game just like this once I finish the new Harry Potter book, I already hade the Dcs Icon setup.
Title: PONG!
Post by: Netham45 on August 11, 2007, 03:42:00 am
lol, sorry.

Also, there is a glitch I didn't see when I was optimizing that causes the paddles to get smaller as you go down on human(gets small at top, gets bigger as you move farther down) and up on AI. It's caused by me using C/Y7 instead of C/Y8-8 because I wasn't thinking when I wrote it for some reason. =/
Title: PONG!
Post by: DJ Omnimaga on August 12, 2007, 06:24:00 pm
i see, i hope you get it fixed :)smile.gif