Computer Science Canada

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:  maxxburnie [ 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>

Author:  jr5000pwp [ 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


: