Hi guys posted last time, making a simple pong game as a coursework and cant seem to get the ball to hit of the paddle I will post the code because I really am stumped with it. any help would be really appreciated.
int ball_width = blueball.getWidth();
int ball_height = blueball.getHeight();
int paddle_width = PaddleImg.getWidth();
int paddle_height = PaddleImg.getHeight();
// Seed the random-number generator with current time so that
// the numbers will be different every time we run.
srand( (unsigned)time( NULL ) );
bool isRequired = true;
//int x = 90;
// Loop until user presses Esc
while (isRequired)
{
Gwin.clear();
if (Keyboard.isPressed('w'))
{
player1.yPos -= PaddleSpeed;
}
if (Keyboard.isPressed('s'))
{
player1.yPos += PaddleSpeed;
}
if (Keyboard.isKeyReady())
{// check if they want to exit
if (Keyboard.waitKey() == GwinKeyNames::ESCAPE)
{// let them exit
isRequired = false;
}
}
}
return 0;
}