hello,
I am currently making pong using visual C++ with the SDL libary. I find that the ball moves too fast for the players and needs to slow down. The code for the movement is in a while loop and vairies speeds 1 - 2 (X and Y).
There are a coupe of ways to do this. One is to change the speed from an int value to a float value and use a smaller increment value. the other is to slow the speed of the game down, since the ball moves at the speed of the loop.
its usually a good idea to never change the speed of the game.
here yet anouther problem, turning everything into float means that i cannot use the random function. i tried changing all the integers to floats on the random function but it didnt work is there a way to make a random float?
CODE:
float random (float max, float min)
{
if (max + min == 0)
{
return 0;
}
float randomNumber = rand() % max + min;
return randomNumber;
}
on the value max it says it must be an integer or enum type