Just before finishing a game of Breakout, the game start to move very slow and the paddle behaves weirdly. The game works fine for the first 40 bricks. What causes this?
This is my code:
GObject object = detectCollision(window, ball);
if (object != NULL)
{
// bounce on paddle
if (object == paddle)
{
if (y > 0)
y = -y;
}
// bounce on bricks
else if (strcmp(getType(object), "GRect") == 0)
{
if (y < 0)
{
y = -y;
removeGWindow(window, object);
// convert i from int to string
sprintf(s, "%i", counter);
setLabel(label, s);
counter++;
}
}
}