Advertisement
Blast06

tipo pacman

Feb 9th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1.  
  2.  
  3.  
  4. #include <stdio.h>;
  5. #include <conio.h>;
  6.  
  7. void main()
  8. {
  9. /*variables */
  10. int x,y;
  11. char t;
  12.  
  13. clrscr();
  14. x=1;
  15. y=1;
  16. do
  17. {
  18. clrscr();
  19. gotoxy(x,y); printf(" ");
  20. gotoxy(x,y+1);printf(" * ");
  21. gotoxy(x,y+2);printf(" ");
  22. t=getch();
  23. switch(t)
  24. {
  25. case(72):if (y>1) y--; else y=22; break; //Up
  26.  
  27. case(80):if (y<22) y++; else y=1; break; //Down
  28.  
  29. case(77):if (x<76) x++; else x=1; break; //right
  30.  
  31. case(75):if (x>1) x--; else x=76; break; //leftt
  32.  
  33.  
  34. }
  35.  
  36. }while (t!=27);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement