Original Post
In my snake game, I finally got everything to work except there are a few minor errors. One thing is that my snake is stops for about 1-2 seconds every once in a while. I know why it is caused, but not really sure. It is because of the Wait function in timers.h. I can mail you my program, but here is my code.
int main()
{
SetMode(MODE_4 | OBJ_ENABLE | OBJ_MAP_1D | BG2_ENABLE);
int x;
DrawBG();
LoadOBJPalette();
InitializeSprites();
sprites[0].attribute0 = COLOR_256 | SQUARE | posy;
sprites[0].attribute1 = SIZE_8 | posx;
sprites[0].attribute2 = 512;
for(x = 8192; x < 8320; x++)
{
OAMData[x] = snakeData[x-8192];
}
while(1){
GetInput();
if(counter == 1)
{
if(posy >= 25)
posy-=5;
Wait(7500);
}
if(counter == 2)
{
if(posy <= 141)
posy+=5;
Wait(7500);
}
if(counter == 3)
{
if(posx >= 15)
posx-=5;
Wait(7500);
}
if(counter == 4)
{
if(posx <= 215)
posx+=5;
Wait(7500);
}
MoveSprite(&sprites[0]);
CopyOAM();
WaitForVsync();
}
}