can somebody help me in making my cursor/player stay inside/between the lines of my maze...
can somebody give me a complete format?
if not tell me what to do...
else your suggestions
can somebody help me in making my cursor/player stay inside/between the lines of my maze...
can somebody give me a complete format?
if not tell me what to do...
else your suggestions
Can you show some code?
If yes, we'll help.
Else, tough.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
I removed your cross post, please don't do it again. Also, "urgent" in your title is bound to annoy a few people. May I suggest you read the rules before posting.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
main()
{
int x = 2, y=2;
char pos;
again:
drawmaze();
gotoxy(x, y);
printf("");
pos = bioskey(0);
if(pos == 's') { y = y + 1; }
if(pos == 'w') { y = y - 1; }
if(pos == 'a') { x = x - 1; }
if(pos == 'd') { x = x + 1; }
goto again;
}
drawmaze()
{
clrscr();
printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄ¿\n");
printf("³ ³ ³ ³\n");
printf("³ ÄÄÄÄÄÄÄÄÂÄÄÄ¿ ÄÄÄÄÄÄÄÄÂÄÄÄ¿ ³ ÚÄÄÄÄ ÚÄÄÄ¿ ÄÄÄÄÂÄÄÄÄ ³ ÄÄÄÄ´\n");
printf("³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³\n");
printf("ÃÄÄÄÄÄÄÄ ³ ÀÄÄÄÄÄÄÄ¿ ³ ³ ÀÄÄÄÙ ³ ³ ÀÄÄÄ¿ ÀÄÄÄÄÄÄÄÁÄÄÄÄ ³\n");
printf("³ ³ ³ ³ ³ ³ ³ ³ ³\n");
printf("³ ÄÄÄÄÂÄÄÄÙ ÚÄÄÄÄ ³ ³ ³ ÚÄÄÄÄÄÄÄ´ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄ ³\n");
printf("³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³\n");
printf("ÃÄÄÄÄ ³ ÄÄÄÄÁÄÄÄ¿ ³ ³ ³ ³ ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ÄÄÄ´\n");
printf("³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³\n");
printf("³ ÚÄÄÄÁÄÄÄÄÄÄÄ¿ ÀÄÄÄ´ ÃÄÄÄÄÄÄÄ´ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄ¿ ÀÄÄÄÂÄÄÄÄÄÄÄ´\n");
printf("³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³\n");
printf("³ ÀÄÄÄ¿ ³ ÀÄÄÄÄ ³ ³ ³ ³ ³ ³ ÚÄÄÄÄÄÄÄ¿ ÀÄÄÄ¿ ³ ³ ³\n");
printf("³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³\n");
printf("ÃÄÄÄ¿ ³ ³ ÚÄÄÄÄÄÄÄÙ ³ ³ ³ ÃÄÄÄÄÄÄÄÙ ³ ³ ÚÄÄÄÁÄÄÄÄÄÄÄ´ ³\n");
printf("³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³\n");
printf("³ ³ ³ ³ ³ ÚÄÄÄÄÄÄÄ´ ÀÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÙ ³ ³ ÚÄÄÄÄÄÄÄÙ ³\n");
printf("³ ³ ³ ³ ³ ³ ³ ³ ³ ³ ³\n");
printf("³ ÀÄÄÄÄÄÄÄÙ ³ ³ ³ ÀÄÄÄÄÄÄÄÄ ³ ÚÄÄÄÄÄÄÄÄ ³ ÀÄÄÄÄÄÄÄ¿ ³\n");
printf("³ ³ ³ ³ ³ ³ E ³\n");
printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÙ\n");
}
how can I let stay in between the lines?
use code tags......
There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!
"...The only real game I thank in the world is baseball..." --Babe Ruth
"Life is beautiful"-Don Corleone right before he died.
"The expert on anything was once a beginner" -Baseball poster I own.
Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.
Do you know how to use arrays? You'll need to use a two-dimensional array which holds the map values. Then before you move the cursor, you check the array to make sure that spot isn't a wall.
First you need to store the world in an array: WorldArray.
Then check whether there is an obstacle in the direction you're walking.
Code:enum { Left, Right, Up, Down }; bool IsObstacle(int X, int Y) { return (WorldArray[X][Y] != ' '); } void Move(int Direction) { switch(Direction) { case Left: if(IsObstacle(PlayerX - 1, PlayerY) == false) { PlayerX--; } break; case Right: if(IsObstacle(PlayerX + 1, PlayerY) == false) { PlayerX++; } break; case Up: if(IsObstacle(PlayerX, PlayerY - 1) == false) { PlayerY--; } break; case Down: if(IsObstacle(PlayerX, PlayerY + 1) == false) { PlayerY++; } break; } }
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
How will i do the world array?
Maybe something like this:
Code:char WordlArray[WIDTH][HEIGHT] = {{'X', 'X', ' ', 'X'}, {'X', ' ', ' ', 'X'}, {'X', ' ', 'X', 'X'}, {'X', ' ', ' ', 'X'}};
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
can I use ascii in that world array?
Just out of my own curiosity, why would you?Originally posted by Oid21
can I use ascii in that world array?
If this is what you mean:Originally posted by Oid21
can I use ascii in that world array?
Then yes!Code:char WordlArray[WIDTH][HEIGHT] = {{3, 3, 0, 3}, {3, 0, 0, 3}, {3, 0, 3, 3}, {3, 0, 0, 3}};
Maybe he wants to use special characters that can't be typed from the keyboard?Originally posted by RoD
Just out of my own curiosity, why would you?
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.