It's just some silly mistakes:
Your first loop in drawFood() function
for(int y = 1; y <= height-1; x++)
{
for(int x = 1; x <= width-1; x++)
{
dbSetWindowTitle("jkjkjk");
if(foodX == x && foodY == y)
{
if(mapVar[foodX][foodY] == emptySpace)
{
//fo
mapVar[foodX][foodY] = foodPiece;
}
}
}
}
Change the very first loop to y++ instead... Hoping that's all it is...
EDIT: I ain't got the media so I can't test the visuals but I'm still looking at it to see if there's anything else...
EDIT2:
void drawSnake()
{
for(int i = movesMade; i >= movesMade-foodEaten; i--)
{
mapVar[lastX[i]][lastY[i]];
dbSetWindowTitle("123456");
}
}
Isn't assigning anything the MapVar[][]...
do
{
foodX = dbRnd(width-1);
foodY = dbRnd(height+1);
} while (mapVar[foodX][foodY] != emptySpace);
I'm assuming this is looking for a non-empty space?
for(int y = 0; y <= height; y++) for(int x = 0; x<= width; x++){mapVar[x][y];}
Also isn't assigning anything...
Tips:
1. Format your code so it's easier to debug.
2. Use the debugger to follow variables. (requires running in debug mode)
Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!