# Gotoxy

• 02-09-2002
drdroid
Gotoxy
I know how to use gotoxy, but how might I use that to create a wall. Heres the scenario: I've created a program where you move an asterisk around the screen. Well I want to turn that in to a maze program. How might I go about making walls?
• 02-09-2002
Stoned_Coder
you could use #.
• 02-09-2002
drdroid
I don't mean it like that... How would I make the wall actually stop the asterisk?
• 02-09-2002
Stoned_Coder
if ( asterix_current_square +1 == '#') // do whatever to stop asterix moving to square.
• 02-09-2002
equinox45
YAAAWWNNN
im bored
• 02-09-2002
drdroid
I tried that statement but I don't know what kind of equation can keep it from going... like an equation that can block it all together...
• 02-09-2002
drdroid
Never Mind
Nevermind I got it...
• 02-09-2002
Unregistered
I don't mean it like that... How would I make the wall actually stop the asterisk?
• 02-09-2002
samGwilliam
Instead of #, use char 219. It's a solid block.

If your game 'arena' is an array of [80] [24] then the following will work:

Code:

```. . . char inkey; while (1) {   if (kbhit ())       inkey = getch ();   if ((inkey == '6') && (arena [x + 1] [y] != 219))   {       x++;       gotoxy (x - 1, y);       printf (" ");   }   if ((inkey == '4') && (arena [x - 1] [y] != 219))   {       x--;       gotoxy (x + 1, y);       printf (" ");   }     if ((inkey == '2') && (arena [x] [y + 1] != 219))   {       y++;       gotoxy (x, y - 1);       printf (" ");   }   if ((inkey == '8') && (arena [x] [y - 1] != 219))   {       y--;       gotoxy (x, y + 1);       printf (" ");   } }```
• 02-10-2002
drdroid