need help making a pong game there is an problem where it doesn't need to hit the paddle to bounce back not sure on fix
Author |
Message |
maxxburnie
|
Posted: Tue May 07, 2013 9:41 am Post subject: need help making a pong game there is an problem where it doesn't need to hit the paddle to bounce back not sure on fix |
|
|
What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>
What is the problem you are having?
<Answer Here>
Describe what you have tried to solve this problem
<Answer Here>
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
<Add your code here>
|
Please specify what version of Turing you are using
<Answer Here>
Description: |
%pong by maxx burnie started 04/23/2013
View.Set ("graphi-cs") % all variables for the game are defined here var chars : array char of boolean var count_p1, count_p2 : int := 0 var bounce_X, bounce_Y, wall_top, wall_bottom, wall_left, wall_righ |
|
Download |
Filename: |
pong.t |
Filesize: |
3.77 KB |
Downloaded: |
80 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
jr5000pwp
|
Posted: Tue May 07, 2013 11:46 am Post subject: Re: need help making a pong game there is an problem where it doesn't need to hit the paddle to bounce back not sure on |
|
|
Looking at it for about 10 seconds I see this: Turing: | %this is where the problem is, not sure whats wrong here.
% for some reason the ball doesnt actualy have to be at the paddle, it will just bounce off the wall
if bounce_X <= go_upX then
X_move := -X_move
end if
% same story here as before
if bounce_X + 5 >= go_upX_two then
X_move := -X_move
end if | Either this is incorrectly named or your if statement is off. You are merely checking if the ball has passed the paddle, not if it has collided with it. You need to have a check on the y axis to see if the ball hit the paddle
|
|
|
|
|
|
|
|