1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
void cmdcent()
{
bool gameLoop = true;
char cmd;
while(gameLoop == true)
{
cmd = getch();
int dir[9][2] = {
{-1, 1}, {0, 1}, {1, 1},
{-1, 0}, {0, 0}, {1, 0},
{-1,-1}, {0,-1}, {1,-1}
};
if( cmd <= '9' && cmd >= '1' )
movechar( dir[cmd-'1'][0], dir[cmd-'1'][1], '0' );
else if( cmd == ';' || cmd == '<' || cmd == '>' )
movechar(0, 0, cmd);
}
} ^ Thanks to you hamsterman
|