Author |
Message |
|
KARTOONCHRIS
Newbie
Joined: 16 Feb 2004 Posts: 23
|
Posted: 18 Feb 2004 02:16:49 pm Post subject: |
|
|
how can you you get like a random ball bounce like in pong? also how can you make it like you face the comp in pong? is there a way, i know of one way but its way to easy to get past. pleez help! i have a ti-83 plus se |
|
Back to top |
|
|
omni
Member
Joined: 14 Jun 2003 Posts: 115
|
Posted: 18 Feb 2004 03:44:26 pm Post subject: |
|
|
are you going to draw the objects on the graph screen or text screen?
A simple way:
increase the ballx and bally coordinate, when it reaches a wall, then reverse the direction the ball is going.
ex if it was going down and hit a wall, it would be going up |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 18 Feb 2004 05:48:40 pm Post subject: |
|
|
Are you working on the programming contest or something? |
|
Back to top |
|
|
Jedd 1980 Pong World Champion
Elite
Joined: 18 Nov 2003 Posts: 823
|
Posted: 18 Feb 2004 05:54:04 pm Post subject: |
|
|
AI for pong is easy. Just have it always move in the direction of the ball. Like if the ball is above the paddle, the paddle moves up. Also, make it either go slower than the ball or mess up every once in a while, so it's beatable.
As for random movements: some coordinates are added to the ball each time it moves to determine the direction of the ball. In order to make it random, add a little or take away a little from these variables (the ones that control the direction) in order to make it move in a slightly different direction. How random it moves is up to you. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 18 Feb 2004 05:55:15 pm Post subject: |
|
|
Jedd wrote: AI for pong is easy. Just have it always move in the direction of the ball. Like if the ball is above the paddle, the paddle moves up. Also, make it either go slower than the ball or mess up every once in a while, so it's beatable.
If that is what 99% of the AI's in the programming contest will do, I think I'll have no problem winning... |
|
Back to top |
|
|
Jedd 1980 Pong World Champion
Elite
Joined: 18 Nov 2003 Posts: 823
|
Posted: 18 Feb 2004 06:12:04 pm Post subject: |
|
|
Speed versus AI's ability: Speed wins. It's a bit different for us BASIC programmers. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 18 Feb 2004 06:25:09 pm Post subject: |
|
|
Jedd wrote: Speed versus AI's ability: Speed wins. It's a bit different for us BASIC programmers.
See, the speed I have no problem with. My AI is also faster. |
|
Back to top |
|
|
Darth Android DragonOS Dev Team
Bandwidth Hog
Joined: 31 May 2003 Posts: 2104
|
Posted: 18 Feb 2004 06:32:58 pm Post subject: |
|
|
here's how (for homescreen):
1->A //ball starting coord
1->B //ditto
Repeat getKey=105
Output(A,B,"* //change the * to what ever ball you want
If A=8
-1->D
If A=1
1->D
If B=16
-1->C
If B=1
1->C
Output(A,B,"(1 space)
A+D->A
B+C->B
End
i think it shoudl work...gonna test it now...
crap...cant see the ball on my 83+ (its goin so fast)
Last edited by Guest on 18 Feb 2004 06:39:03 pm; edited 1 time in total |
|
Back to top |
|
|
KARTOONCHRIS
Newbie
Joined: 16 Feb 2004 Posts: 23
|
Posted: 18 Feb 2004 06:45:23 pm Post subject: |
|
|
i tried it and it didn't work, it just shows th "*" in the top left corner. i went over and made sure i didn't miss something. |
|
Back to top |
|
|
KARTOONCHRIS
Newbie
Joined: 16 Feb 2004 Posts: 23
|
Posted: 18 Feb 2004 06:53:08 pm Post subject: |
|
|
now its going relly fast, i cant see it! |
|
Back to top |
|
|
KARTOONCHRIS
Newbie
Joined: 16 Feb 2004 Posts: 23
|
Posted: 18 Feb 2004 06:58:16 pm Post subject: |
|
|
ok i got it to work, i put a for(E,1,100 after Output(A,B,"*".
it works now.
thanx |
|
Back to top |
|
|
KARTOONCHRIS
Newbie
Joined: 16 Feb 2004 Posts: 23
|
Posted: 18 Feb 2004 08:07:09 pm Post subject: |
|
|
ok i got the random ball thing but how do you use hit detection for the paddle?
pleez help
oh yeah its for the home screen..
Last edited by Guest on 18 Feb 2004 08:13:56 pm; edited 1 time in total |
|
Back to top |
|
|
Jedd 1980 Pong World Champion
Elite
Joined: 18 Nov 2003 Posts: 823
|
Posted: 18 Feb 2004 08:41:55 pm Post subject: |
|
|
Ok I'm just guessing you are doing text. Hit detection for the paddle is also very simple. If the ball is at 1 or 16 (both sides of the screen) then it will check to see if it is on the same place as the paddle. If so, the ball changes directions. If not, the other player gets a point, and a new game starts.
Btw, please nobody post code. It's better if he figures it out himself. I'm assuming this is for the programming competition, and it just wouldn't be right if he entered someone else's program. Sorry Chris, but it's the only way you can learn. |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 19 Feb 2004 09:11:57 am Post subject: |
|
|
No need to quadruple post, thank you.
BTW, I'd suggest an AI that goes to the middle of the screen when the ball is going away from him, and goes to an estimated point of where the ball will go if it's going towards him, isn't too difficult to do, nor will it slow things down too much and it's very realistic and there's plenty of room for easyer AI settings with wrong estimates and stuff.
Last edited by Guest on 19 Feb 2004 09:12:56 am; edited 1 time in total |
|
Back to top |
|
|
KARTOONCHRIS
Newbie
Joined: 16 Feb 2004 Posts: 23
|
Posted: 19 Feb 2004 04:41:03 pm Post subject: |
|
|
im not in the competition |
|
Back to top |
|
|
KARTOONCHRIS
Newbie
Joined: 16 Feb 2004 Posts: 23
|
Posted: 19 Feb 2004 04:55:40 pm Post subject: |
|
|
ok, heres my code so far..
clrhome
1->A
1->B
7->E
5->F
repeat G=105
getkey->G
if ans:output(E,F," " // 3 spaces
output(A,B,"o"
for(Z,1,75
end
if A=8
-1->D
if A=1
1->D
if B=16
-1->C
if B=1
1->C
if A=F and A=E
-1->D
F+2(G=26)-2(G=24->F
output(E,F,"==="
output(A,B," "
A+D->A
B+C->B
end
maybe i put (if A=f and A=E -1->D) in the wrong place or something. if you know why it doesn't work pleez reply!
also how do you make it to where when the paddle gets so far over it doesn't give me an error. pleez reply!!!!
Last edited by Guest on 19 Feb 2004 05:53:10 pm; edited 1 time in total |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 20 Feb 2004 08:50:00 am Post subject: |
|
|
If you don't stop double posting I'm going to lock this. |
|
Back to top |
|
|
JeePee
Member
Joined: 18 Jan 2004 Posts: 181
|
Posted: 20 Feb 2004 10:54:11 am Post subject: |
|
|
Made my pong game for the contest too, but in ASM! I didn't gave it AI, but I let you play against yourself: four bats, one on each side of the screen! But that's fun! So you don't even need AI! |
|
Back to top |
|
|
KARTOONCHRIS
Newbie
Joined: 16 Feb 2004 Posts: 23
|
Posted: 24 Feb 2004 07:39:20 pm Post subject: |
|
|
sorry, pleez help |
|
Back to top |
|
|
Jedd 1980 Pong World Champion
Elite
Joined: 18 Nov 2003 Posts: 823
|
Posted: 24 Feb 2004 07:53:16 pm Post subject: |
|
|
Haha, "pleez help"? No one is going to help you at this rate. Either follow Sir Robin's advice (do I even need to say it?) or find some online tutorials. The code for which you are asking is VERY simple code, so obviously you know very little about programming Basic. If you have a request, go ahead and make it. But "pleez help" just ain't good enough around here... |
|
Back to top |
|
|
|