Me and my freinds are heading towards a C++ Game Project of Snake-Game in which a Snake is to be made of 6 "*"s and it is controlled with keybord....
We had progressed till here and weare finding difficulty in handaling more than 1 stars plz help
include<iostream.h>
include<conio.h>
void main()
{
int x=1,y=1;
char c;
for(;;)
{
_setcursortype(_NOCURSOR); //Stops showing the cursor
clrscr();
gotoxy(x,y); //Function that allows cursor to go on x,y coordinate of screen
cout<<"*";
c=getch(); //Alternative of cin,
//Difference : No need to press enter
switch((int)c)
{
case 77:
{
x++;
if(x>80) //Sets up virtual wall on right side
{
x=80;
}
break;
}
case 75:
{
x--;
if(x<1) //Sets up virtual wall on left side
{
x=1;
}
break;
}
case 72:
{
y--;
if(y<1) //Sets up virtal ceiling
{
y=1;
}
break;
}
case 80:
{
y++;
if(y>25) //Sets up virtual floor
{
y=25;
}
break;
}
}
if((int)c==13)
{
break;
}
}
if((int)c!=13)
{
getch();
}
}
Plz Help henceon