
-----------------------------------
Clayton
Mon Jan 16, 2006 4:33 pm

help plz Pong
-----------------------------------
how can i improve on this game, and how would i be able to get it so that u can have a beatable comp? plz help

-----------------------------------
pavol
Mon Jan 16, 2006 5:48 pm


-----------------------------------
you could make the game go faster (smaller delay and/or smaller screen). and for the beatable comp, everytime that you hit the ball (right now the comp's center of the paddle is attached to the ball) randomize where the ball will be attached. so if you randomize 0 the comp will hit the ball with the center of the paddle, if you randomize something like 25 the comp will hit it with the edge of the paddle, and 30 the comp would miss the ball. 
hope it helps

-----------------------------------
theuberk
Mon Jan 16, 2006 7:13 pm


-----------------------------------
Yes, you could randomize it, like pavol pointed out. You could also slow down how fast the paddle moves. For example:

 ypos = the y position of the paddle 


var ypos, ballpos : int

loop
    delay(25) %or however slow you want the paddle to move
    if ballpos > ypos then
       ypos := ypos + 1
    elsif ballpos < ypos then
       ypos := ypos - 1
    end if
end loop


So instead of the comp being "locked" to the ball's position, the comp will check to see if the ball is above or below it, and then move to it accordingly. The computer will either be fast of slow depending on the delay (higer delay = slower computer).

-----------------------------------
Clayton
Tue Jan 17, 2006 10:55 pm


-----------------------------------
you could make the game go faster (smaller delay and/or smaller screen). and for the beatable comp, everytime that you hit the ball (right now the comp's center of the paddle is attached to the ball) randomize where the ball will be attached. so if you randomize 0 the comp will hit the ball with the center of the paddle, if you randomize something like 25 the comp will hit it with the edge of the paddle, and 30 the comp would miss the ball. 
hope it helps

what kink of code would i use to prog that cuz i cant figure out how to have the paddle the same size and not hit it on the center

-----------------------------------
pavol
Wed Jan 18, 2006 11:16 am


-----------------------------------
well, right now you're probably using either the same variable for ball x/y and paddle x/y (im not sure i don't have your code here), so instead of making the paddle x = the ball x you could do something like:
var paddleX, ballX, paddleRnd : int

randint (paddleRnd, 1,100)

paddleX := paddleRnd * (paddleRnd div 100)
i don't think this is exactly right im just using it as an example. this is what i meant, "randomize where the ball will be attached". or you could always not randomize and just say
paddleX := ballX +/- ?
i know it's vague but i hope that clears it up a bit :D

-----------------------------------
Clayton
Tue Jan 24, 2006 2:17 am


-----------------------------------
thanks for the help it helped a lot i understand what you meant now

-----------------------------------
Drakain Zeil
Tue Jan 24, 2006 12:16 pm


-----------------------------------
I suggest against the use of a delay in a game...

Instead, build it in a loop with timers... for example:

Time2:=now
Time1:=now
loop 
if Time1-Time2 > X then
Time1:=now
doWhatever
end if
time 2:=now
end loop

Or something along those lines anyway. It lets your program keep running, and will only run that block of code when it's needed, instead of pausing the entire program to make something move slowly.

Also, you could try:

if Input.hasch then
doWhatever
end if
