SO CLOSE i can taste that ball smacking off the paddle the right way, anyways, its reading the center of the paddle wrong, because the numbers say that the right edge is the center, i know because i halted the movment of the ball with the paddle and i moved the padle around while the ball was holding still, and the left edge is "0.0" and the right edge is "2.0" how do i fix this? so the center is "0.0" and the edges are "-1.0" for the left and "1.0"for the right?
heres my code if it helps btw i figured out the numbers to make it whatever less times i have to put a decimal
And the display code was also altered to match the real code:
heres my code if it helps btw i figured out the numbers to make it whatever less times i have to put a decimal
Function ballmovement() newspeedx = (ball_x+7 - player_x+100)*.01 ball_x = ball_x + bal_xdir*5 ball_y = ball_y + bal_ydir*5 If ball_y < 0 Then bal_ydir = 1 If ball_y > 1040 Then move=0 lifes=lifes-1 If ball_x < 0 Then bal_xdir = 1 If ball_x > 1670 Then bal_xdir = -1 If RectsOverlap(ball_x,ball_y,15,15,player_x,player_y,100,20) Then bal_ydir = -1 bal_xdir = newspeedx If move=0 Then ball_y=player_y+-20 ball_x=player_x+40 End If End Function
And the display code was also altered to match the real code:
Color 255,255,255 Text 0, 0,(ball_x+7 - player_x+100)*.01