i'm trying to cause my object to move diagonally in 45deg. When it hits SCREEN WIDTH it should bounce up, im making somewhere a big mistake but can't figure it out.
distance = 0;
etiSpeed = 1;
t2 = SDL_GetTicks();
delta = (t2 - t1) * 0.001;
t1 = t2;
distance += etiSpeed * delta;
ball_x = ball_x * distance * ball_x_vel;
ball_y = ball_y * distance * ball_y_vel;
if (ball_x < SCREEN_WIDTH)
{
ball_x_vel = 1;
DrawSurface(screen, ball, ball_x, ball_y);
}
else if (ball_x = SCREEN_WIDTH)
{
ball_x_vel = -1;
DrawSurface(screen, ball, ball_x, ball_y);
}