slinga
Established Member
1) What do I use to seed srand()? I tried using something from time.h, but interstingly enough, whenever I used it, my controller input stopped :huh I need this for placement of the food.
2) I'm using dynamically allocated linked-lists for my snake clone. When the snake dies, I use the following code:
I commented out the free() because it was giving me weird, fluky errors. An example would be if the snake dies by hitting the top or the bottom of the screen, and the player comes back, there would be no problem. But if ther snake hit the left or right side of the screen, the player would be initialized to some bogus position on the screen (I could tell by printing out the coordinates).
2) I'm using dynamically allocated linked-lists for my snake clone. When the snake dies, I use the following code:
Code:
void killSnake(struct location* snakeHead)
{
if(snakeHead->next!=NULL)
{
killSnake(snakeHead->next);
}
slPrint(" ", slLocate(snakeHead->x, snakeHead->y));
//free(snakeHead); // gives me weird errors
}
I commented out the free() because it was giving me weird, fluky errors. An example would be if the snake dies by hitting the top or the bottom of the screen, and the player comes back, there would be no problem. But if ther snake hit the left or right side of the screen, the player would be initialized to some bogus position on the screen (I could tell by printing out the coordinates).