I'm implementing part 9 of 10 in pset 4 when I found a flaw in my code. First, pseudo-code:
If ball is below the screen
- remove ball
- Refer to initBall function to create new ball which is centered.
- reduce lives by 1
The issue is that my code seems to think the ball stays at the bottom of the window. A new ball centres, but my lives go to 0 and the code exits -- It WaitsFor Click and Exits.
I don't know how to gdb it because it requires switching from the breakout window to the terminal.
Feel free to delete this if 'unreasonable':
while(lives > 0)
detect mouse events...
move ball
if(getY(ball) >= getHeight(window))
{
removeGWindow(window, ball);
GOval ball = initBall(window);
lives--;
printf("%d", lives);
}
Thank you so so much, hope it's clear, spent all day on this! Guy