I am trying to get the paddle moving with the mouse but I keep getting the same error message : "Segmentation Fault (Core Dumped)".
This is my function, which is very simple. Any suggestions?
// keep playing until game over
while (lives > 0 && bricks > 0)
{
// follow mouse forever
while (true)
{
// check for mouse event
GEvent event = getNextEvent(MOUSE_EVENT);
// if we heard one
if (event != NULL)
{
// if the event was movementc
if (getEventType(event) == MOUSE_MOVED)
{
// ensure paddle follows top cursor
double x = getX(event);
double y = 500;
setLocation(paddle, x, y);
}
}
}
}
gdb
, see what is the last line before the error.